\Forum
Forum represents a collection of forum threads. Each thread is a different topic on the site. You can customize permissions on a per forum basis in the CMS.
Synopsis
class Forum
extends Page
{
- // members
- private static string $allowed_children = 'none';
- private static string $icon = "forum/images/treeicons/user";
- public static boolean $notify_moderators = false;
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $defaults = ;
- public static integer $posts_per_page = 8;
- public static bool $redirect_post_urls_to_thread = false;
- // methods
- public void canView()
- public void canPost()
- public void canModerate()
- public bool canAttach()
- public void requireTable()
- public void requireDefaultRecords()
- public void getShowInCategories()
- public FieldList getCMSFields()
- public string Breadcrumbs()
- public ForumHolder getForumHolder()
- public Post getLatestPost()
- public int getNumTopics()
- public int getNumPosts()
- public int getNumAuthors()
- public DataList getTopics()
- public void getStickyTopics()
Hierarchy
Extends
- Page
Tasks
Line | Task |
---|---|
12+ | Implement PermissionProvider for editing, creating forums. |
Members
private
- $allowed_children
- $db
- $defaults
- $has_one
- $icon
- $many_many
public
-
$notify_moderators
Enable this to automatically notify moderators when a message is posted or edited on his forums. - $posts_per_page
—
int
Number of posts to include in the thread view before pagination takes effect. - $redirect_post_urls_to_thread
—
bool
When migrating from older versions of the forum it used post ID as the url token as of forum 1.0 we now use ThreadID. If you want to enable 301 redirects from post to thread ID set this to true
Methods
public
- Breadcrumbs() — Create breadcrumbs
- canAttach() — Can we attach files to topics/posts inside this forum?
- canModerate() — Check if user has access to moderator panel and can delete posts and threads.
- canPost() — Check if the user can post to the forum and edit his own posts.
- canView() — Check if the user can view the forum.
- getCMSFields() — Returns a FieldList with which to create the CMS editing form
- getForumHolder() — Helper Method from the template includes. Uses $ForumHolder so in order for it work it needs to be included on this page
- getLatestPost() — Get the latest posting of the forum. For performance the forum ID is stored on the {@link Post} object as well as the {@link Forum} object
- getNumAuthors() — Get the number of distinct Authors
- getNumPosts() — Get the number of total posts
- getNumTopics() — Get the number of total topics (threads) in this Forum
- getShowInCategories() — Check if we can and should show forums in categories
- getStickyTopics()
- getTopics() — Returns the Topics (the first Post of each Thread) for this Forum
- requireDefaultRecords() — Add default records to database
- requireTable()