DocsOForumFilters & Action Hooks
Developer

Filters & Action Hooks

OForumorravo.com/docs/oforum/filters-action-hooks

Filters

php// Modify allowed reaction emojis
add_filter('of_allowed_emojis', function($emojis) {
    return ['👍', '❤️', '🎉', '🤔', '👀'];
});

// Modify room visibility check
add_filter('of_room_can_view', function($can, $room_id, $user_id) {
    // Custom logic
    return $can;
}, 10, 3);

// Modify reply content before save
add_filter('of_reply_content', function($content, $user_id) {
    // e.g. strip disallowed HTML
    return $content;
}, 10, 2);

Actions

php// Fired after a thread is created
add_action('of_thread_created', function($thread_id, $room_id, $author_id) {
    // Custom logic
}, 10, 3);

// Fired after a reply is created and published
add_action('of_reply_created', function($reply_id, $thread_id, $author_id) {
    // Custom logic
}, 10, 3);

// Fired after trust level changes
add_action('of_trust_level_changed', function($user_id, $new_level, $old_level) {
    // e.g. award badge
}, 10, 3);

// Fired after a report is filed
add_action('of_report_filed', function($report_id, $reporter_id, $post_id) {
    // e.g. notify admin
}, 10, 3);

Note: The above hooks are documented for v1.1.0 planned implementation. In v1.0.0, use the CPT save_post_of_thread and save_post_of_reply hooks directly.


Filters & Action Hooks — OForum Docs — Orravo