DocsOForumSubscriptions & Notifications
Reference

Subscriptions & Notifications

OForumorravo.com/docs/oforum/subscriptions-notifications

Subscriptions

Users can follow a room or a thread. Following sends email notifications when new threads/replies are posted (based on the user's frequency preference).

Types:

  • room — notified when any new thread is posted in the room
  • thread — notified when any new reply is posted in the thread

Frequencies:

  • immediate — email sent immediately on each new post
  • daily — queued for daily digest (not yet implemented in v1.0.0)
  • weekly — queued for weekly digest (not yet implemented in v1.0.0)
  • none — in-forum notification only, no email

PHP API:

phpOF_Notify::subscribe($user_id, 'thread', $thread_id, 'immediate');
OF_Notify::unsubscribe($user_id, 'thread', $thread_id);
$is_subbed = OF_Notify::is_subscribed($user_id, 'thread', $thread_id);

In-forum notifications

Notifications are stored in wp_of_notifications. The notification bell in the frontend header shows an unread count badge and a dropdown of recent notifications.

Notification types:

  • new_reply — someone replied to a thread you follow
  • mention — someone @mentioned you
  • moderation_notice — a moderator actioned one of your posts
  • solution_accepted — your reply was marked as the solution

Creating a notification (PHP):

phpOF_Notify::create($user_id, [
    'type'      => 'mention',
    'post_id'   => $post_id,
    'from_user' => $author_id,
    'message'   => 'John Doe mentioned you.',
    'url'       => get_permalink($post_id) . '#reply-' . $reply_id,
]);

Polling: The frontend JS polls for unread counts every 60 seconds via AJAX (of_get_notifications).

@mentions

When a reply is submitted, OF_Notify::parse_mentions() scans the content for @username patterns. It resolves users by user_login and user_slug. Mentioned users receive an immediate in-forum notification.


Subscriptions & Notifications — OForum Docs — Orravo