Forum model represents a forum section in ForkBB. It extends DataModel and provides properties and methods for managing forums, subforums, moderators, and forum-specific permissions.
Location
app/Models/Forum/Forum.php
Properties
Unique forum identifier
Forum display name
Parent forum ID (null for top-level forums)
Total number of topics in the forum
Total number of posts in the forum
Timestamp of the last post
ID of the last post
Username of the last poster
Title of the last topic with activity
Permission to create topics (1=allowed, null=use group default)
Permission to reply to topics (1=allowed, null=use group default)
Redirect URL if forum is a redirect link
Topic sorting method (0=last post desc, 1=posted desc, 2=subject, etc.)
Current page number
Computed Properties
Parent forum object. Returns
null for root forum (id=0).Forum name (alias for
forum_name)URL-friendly forum name for links
Array of direct subforum objects indexed by forum ID
Array of all descendant forums (including nested subforums)
Array of moderator data with name and link for each moderator
Aggregated statistics for this forum and all descendants
Total number of pages based on topic count and user display settings
Pagination array for forum pages
Permission Properties
Returns
true if current user can create topics in this forumReturns
true if current user can mark all topics as readReturns
true if current user can subscribe to forum updatesLink Properties
URL to the forum page
URL to search for new posts in this forum
URL to the last post in the forum
URL to create a new topic
URL to mark all topics as read
URL to subscribe to forum updates
URL to unsubscribe from forum updates
Methods
modAdd()
Adds one or more users as moderators to the forum.Variable number of User objects to add as moderators
modDelete()
Removes one or more users from the forum’s moderator list.Variable number of User objects to remove as moderators
hasPage()
Checks if the current page number is valid for this forum.bool - true if page is valid
Example:
pageData()
Returns an array of topics for the current page.InvalidArgumentException if page number is invalid
Example:
calcPage()
Calculates which page a specific topic is on within the forum.Topic ID to find
Usage Example
Sorting Options
Thesort_by property controls topic sorting:
0- Last post DESC (default)1- Posted DESC2- Subject ASC4- Last post ASC5- Posted ASC6- Subject DESC