
內容簡介
Ringier-Bus 是一款將 WordPress 文章事件自動推送至 Ringier Event Bus 的外掛,當文章建立、更新或刪除時即時觸發事件,串接 Hexagon 生態系服務,實現文章同步、資料湖儲存與內容分發等企業級整合功能。
【主要功能】
• 文章建立、更新、刪除時自動推送事件至 Ringier Event Bus
• 同步文章至 Sailthru 媒體庫
• 將文章事件儲存至 Ringier Datalake 供內容分發引擎使用
• 提供三組自訂篩選器,可調整推送的 JSON 資料內容
• 內建錯誤記錄檔,可於後台介面檢視與清除
• 自動建立「文章生命週期」與「發布原因」兩個自訂欄位
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
A plugin to push events to the Ringier Event Bus when articles are created, updated or deleted.
AUDIENCE
This plugin is made for Ringier businesses using WordPress and wanting to benefit from Hexagon solutions available via the Ringier Event Bus. It can be implemented by developers and non-developers.
BENEFITS
The Hexagon solutions available via the Ringier Event Bus and compatible with this plugin include:
– The syncing of articles with Sailthru media library,
– The storage of article events in Ringier Datalake, from which they are retrieved by the Content Distribution Engine (CDE).
You can also benefit from the Bus tooling such as event logging, event monitoring and alerting.
To learn more about Hexagon services, visit https://hexagon.ringier.com/services/business-agility/.
HOW IT WORKS
The plugin automatically triggers events when articles are created, updated and deleted.
Event names: ArticleCreated, ArticleUpdated and ArticleDeleted.
The events are scheduled to be sent to the Bus within a 1-minute delay. This is to allow WordPress to process the changes and update custom fields in the database, which is done asynchronously. You can view scheduled events by making use of the plugin “Advanced Cron Manager”.
Here is a summary of the events sent to the Bus:
– If the article is newly created, we send it INSTANTLY – sent as ArticleCreated
– But then we schedule it to run again after the normal 1 minute so that all custom data are sent properly – sent as ArticleUpdated
– For all existing articles that undergo an update, we schedule the event to run after the 1 minute interval
The plugin also creates two mandatory custom fields, available on the article editor page under “Event Bus” widget:
– The article lifetime (lifetime)
– The publication reason (publication_reason)
We also expose custom filters to help you adjust these two fields and the payload sent to the BUS endpoint, see below.
LOGS
This plugin creates a log file (ringier_bus_plugin_error_log), saved inside the wp-content/ folder:
The error messages are viewable via the admin UI by clicking on the submenu “LOG”.
You also have the flexibility to clear the log file via the UI itself.
CUSTOM FILTERS
The plugin exposes three custom filters to help you adjust the plugin’s JSON Payload that is sent to the BUS endpoint.
1. Modifying the Publication Reason
You can customize the publication reason for an article by using the ringier_bus_get_publication_reason filter. This filter allows you to modify the publication reason before it is sent to the Ringier Event Bus.
Example:
php
function custom_publication_reason(string $publication_reason, int $post_ID): string
{
// Your custom logic goes here
return 'Custom Publication Reason';
}
add_filter('ringier_bus_get_publication_reason', 'custom_publication_reason', 10, 2);
2. Modifying the Article Lifetime Payload
You can customize the article lifetime for an article by using the ringier_bus_get_article_lifetime filter. This filter allows you to modify the article lifetime before it is sent to the Ringier Event Bus.
Example:
php
function custom_article_lifetime(string $article_lifetime, int $post_ID): string
{
// Your custom logic goes here
return 'Custom Article Lifetime';
}
add_filter('ringier_bus_get_article_lifetime', 'custom_article_lifetime', 10, 2);
3. Modifying the Article Payload Data
You can customize the payload data for an article by using the ringier_bus_build_article_payload filter. This filter allows you to modify the payload data before it is sent to the Ringier Event Bus.
Example:
`php
function custom_build_article_payload(array $payload_array, int $post_ID, WP_Post $post): array
{
// Add a custom field to the payload for example
$payload_array[‘custom_field’] = ‘Custom Value’;
return $payload_array;
}
add_filter(‘ringier_bus_build_article_payload’, ‘custom_build_article_payload’, 10, 3);
`
4. Controlling Author Event Dispatch
You can control whether the Ringier Bus plugin should dispatch Author events for a specific user by using the ringier_bus_should_dispatch_author_event filter.
This filter allows you to override the default logic to force enablement or disablement based on your own custom logic – when you want full control over which authors get sent to the Event Bus.
Example:
`php
/**
* Example: Prevent event dispatch for a specific user ID.
*/
add_filter(‘ringier_bus_should_dispatch_author_event’, function (bool $should_dispatch, int $user_id): bool {
// Example: Always send events for Administrators, ignoring the "Show Profile" checkbox
if (user_can($user_id, 'administrator')) {
return true;
}
// Example condition: never sync user ID 1234
if ($user_id === 1234) {
return false;
}
// Otherwise, use the default logic
return $should_dispatch;
}, 10, 2);
`
This filter gives you full flexibility to:
– Disable syncing for certain authors
– Force syncing regardless of profile visibility
– Apply environment-specific rules (e.g., staging vs production)
– Implement client-specific dispatch policies
Contributing
There are many ways you can contribute:
– Raise an issue if you found one,
– Provide us with your feedback and suggestions for improvement,
– Create a Pull Request with your bug fixes and/or new features. GitHub repository: https://github.com/RingierIMU/mkt-plugin-wordpress-bus
Credits/Thanks
1) Wasseem Khayrattee – for creating and maintaining the plugin
2) Mishka Rasool – for conceiving/creating the banner and logo asset files
