Threads are of_thread CPT posts. URLs are /forum/thread/[slug]/.
Thread Meta Keys
| Key | Type | Description |
|---|---|---|
of_thread_room_id | int | Room the thread belongs to |
of_thread_type | string | discussion, question, announcement, showcase |
of_thread_sticky | int | 1 = pinned to top of room |
of_thread_closed | int | 1 = no new replies (except mods) |
of_thread_solved | int | 1 = has an accepted solution |
of_thread_solution_id | int | Reply ID of accepted solution |
of_thread_reply_count | int | Cached reply count |
of_thread_views | int | View count |
of_thread_last_reply | datetime | Last reply timestamp (for sorting) |
of_thread_last_reply_uid | int | User ID of last replier |
Querying threads
php$result = OF_Query::get_threads([
'room_id' => 5,
'thread_type' => 'question',
'sticky_first' => true,
'page' => 1,
'per_page' => 25,
'orderby' => 'last_reply', // last_reply | date | reply_count
]);
// Returns:
// [
// 'threads' => [...], // array of formatted thread arrays
// 'total' => 42,
// 'max_pages' => 2,
// ]
Thread admin actions (AJAX)
All admin thread actions use the of_thread_action AJAX endpoint with action_type:
sticky— Toggle stickyclose— Toggle closeddelete— Trash the threadapprove— Publish a pending thread
