DocsOForumREST API & Hooks
Developer

REST API & Hooks

OForumorravo.com/docs/oforum/rest-api-hooks

REST API

Base: /wp-json/oforum/v1/

MethodEndpointAuthDescription
GET/roomsPublicList all public rooms
GET/rooms/{id}/threadsPublicPaginated thread list for a room
POST/threadsWP authCreate a new thread
GET/threads/{id}PublicThread details
PATCH/threads/{id}Author/ModUpdate thread (title, close, sticky)
DELETE/threads/{id}Author/ModDelete thread
GET/threads/{id}/repliesPublicPaginated replies
POST/threads/{id}/repliesWP authPost a reply
PATCH/replies/{id}Author/ModEdit a reply
DELETE/replies/{id}Author/ModDelete a reply
POST/replies/{id}/reactWP authToggle emoji reaction
GET/searchPublicFull-text search

Action Hooks

phpadd_action( 'of_thread_created',  function( int $thread_id, int $room_id, int $user_id ) {} );
add_action( 'of_reply_posted',    function( int $reply_id, int $thread_id, int $user_id ) {} );
add_action( 'of_thread_solved',   function( int $thread_id, int $reply_id ) {} );
add_action( 'of_user_banned',     function( int $user_id, string $type, int $mod_id ) {} );

Filter Hooks

php// Modify thread query args
add_filter( 'of_thread_query_args', function( array $args, int $room_id ): array {
    return $args;
}, 10, 2 );

// Extend reply data sent to frontend
add_filter( 'of_reply_data', function( array $data, int $reply_id ): array {
    return $data;
}, 10, 2 );

Shortcodes

ShortcodeDescription
[oforum]Full forum index
[oforum_room id="5"]Single room
[oforum_thread id="42"]Single thread
[oforum_search]Search box
[oforum_notifications]Notification bell (for use in themes)
REST API & Hooks — OForum Docs — Orravo