Forum & Community

Add a full-featured community forum to your Larapen site with threaded discussions, nested replies, upvote/downvote voting, best answer selection, and content moderation.

Threaded Discussions

Categorized threads with translatable titles and content. Pin, feature, lock, or close threads from the admin panel.

Nested Replies

Two-level reply threading with parent/child relationships. Users can reply directly to other replies.

Voting System

Upvote and downvote threads and replies via AJAX. Toggle votes on/off. Self-voting prevention.

Best Answer

Thread authors and admins can mark a reply as the best answer. Solved threads are highlighted in listings.

Content Moderation

User reporting with configurable auto-hide thresholds. Admin dashboard for reviewing, hiding, and dismissing reported content.

Email Notifications

Configurable email alerts for new threads, replies, nested replies, best answer selections, and content reports.

Use Cases

Product Support Forum

You sell software products and need a community forum where customers can ask questions and help each other.

  • Create a forum category for each product.
  • Enable “Best Answer” so thread authors can mark the most helpful reply.
  • Use the Envato integration to require a verified purchase before posting (see Envato Integration).
  • Admin notifications alert you to new threads that need attention.

Community Knowledge Base

You run a community site and want members to share knowledge through discussions.

  • Organize topics into categories and subcategories.
  • Use voting to surface the most helpful content.
  • Pin important threads (announcements, guides) to the top of listings.
  • Enable reporting so the community can self-moderate.

Internal Team Forum

You need a private discussion space for your team or organization.

  • Disable guest viewing: only authenticated users can access the forum.
  • Disable guest creation and replies: require login for all interactions.
  • Use categories to organize discussions by department or project.

Requirements

  • Larapen CMS v1.0.0 or later
  • PHP 8.3+
  • MySQL 8.0+
Optional: The Envato Market Integration add-on enables purchase-gated forum access (require a verified Envato purchase to create threads in specific categories).

Installation

Step 1: Place the Add-on

Copy or symlink the forum folder into your Larapen "extensions/addons" directory:

Step 2: Activate the Add-on

Go to Admin → Add-ons → Installed Add-ons and activate Forum & Community.

Step 3: Run Migrations

This creates 5 tables: forum_categories, forum_threads, forum_replies, forum_votes, and forum_reports.

Step 4: Set Permissions

The add-on registers 12 permissions (see Permissions). Assign them to admin roles via Admin → Users → Roles & Permissions.

Step 5: Create Categories

Navigate to Admin → Forum → Categories and create your first forum categories. The forum requires at least one category before threads can be created.

Step 6: Configure

Navigate to Admin → Forum → Settings to configure access control, voting, moderation, notifications, and display options. See Configuration.

Configuration

All settings are managed in Admin → Forum → Settings (stored in the settings table, group forum). Defaults come from config/forum.php.

Access Control

Setting Description Default
forum_guests_can_view Allow non-logged-in visitors to browse threads and replies. true
forum_guests_can_create Allow non-logged-in visitors to start new threads. false
forum_guests_can_reply Allow non-logged-in visitors to post replies. false

Voting

Setting Description Default
forum_voting_enabled Enable upvote/downvote on threads and replies. true

The allow_self_vote option is in config/forum.php only (default: false).

Best Answer

Setting Description Default
forum_best_answer_enabled Enable best answer selection on threads. true
forum_author_can_select Thread author can mark a reply as best answer. true
forum_admin_can_select Administrators can mark a reply as best answer on any thread. true

Moderation

Setting Description Default
forum_require_approval New threads and replies require admin approval before appearing publicly. false
forum_allow_reporting Users can flag inappropriate replies for admin review. true
forum_max_reports_auto_hide Automatically hide a reply after this many reports (1–50). 5

Notifications

Setting Description Default
forum_notify_admin_on_new_thread Email administrators when a new thread is created. true
forum_notify_author_on_reply Email the thread author when someone posts a reply. true
forum_notify_on_reply_to_reply Email a reply author when someone responds to their reply. true
forum_notify_on_best_answer Email the reply author when their reply is marked as best answer. true
forum_notify_admin_on_report Email administrators when content is reported. true

Display

Setting Description Default
forum_threads_per_page Number of threads shown per page on the forum listing. 15
forum_replies_per_page Number of replies shown per page on a thread detail page. 20

CAPTCHA

Setting Description Default
forum_captcha_enabled Require CAPTCHA verification when creating threads or posting replies. false

Config File Defaults

The file config/forum.php contains additional defaults that are not exposed in the admin settings panel:

Key Description Default
voting.allow_self_vote Allow users to vote on their own threads/replies. false
threads.allow_editing Allow thread authors to edit their threads. true
threads.edit_time_limit Minutes after posting that editing is allowed (0 = unlimited). 30
threads.allow_deleting Allow thread authors to delete their threads. true
threads.min_title_length Minimum character length for thread titles. 5
threads.max_title_length Maximum character length for thread titles. 200
threads.min_content_length Minimum character length for thread content. 10
replies.allow_editing Allow reply authors to edit their replies. true
replies.edit_time_limit Minutes after posting that editing is allowed (0 = unlimited). 30
replies.allow_deleting Allow reply authors to delete their replies. true
replies.min_content_length Minimum character length for reply content. 2

Admin: Settings

The settings page (Forum → Settings) is organized into six sections:

Access & Permissions

  • Allow guests to view the forum: toggle switch
  • Allow guests to create threads: toggle switch
  • Allow guests to reply to threads: toggle switch

Features

  • Voting: enable/disable the upvote/downvote system
  • Best Answer: enable/disable best answer selection, with sub-toggles for whether the thread author and/or admins can select the best answer

Moderation

  • Require approval for new posts: toggle switch
  • Allow users to report replies: toggle switch
  • Auto-hide after reports: numeric input (1–50)

Notifications

Five independent toggle switches controlling email notifications for various forum events (new thread, reply, reply-to-reply, best answer, content report).

CAPTCHA Protection

  • Enable CAPTCHA for threads and replies: requires a CAPTCHA provider to be configured in the core settings first.

Display

  • Threads per page: numeric input (5–100)
  • Replies per page: numeric input (5–100)

Admin: Threads

Thread List

The Threads page (Forum → All Threads) shows a paginated table (20 per page) with:

  • Title (translatable)
  • Category
  • Author
  • Status: open, closed, or locked (with color-coded badges)
  • Reply count
  • View count
  • Pinned / Featured indicators
  • Best Answer indicator (solved/unsolved)
  • Last activity date

Filterable by category and status via dropdown selectors.

Create & Edit

The thread form includes:

  • Title: translatable text fields per active locale (required for default locale, min 5, max 200 characters)
  • Slug: translatable, auto-generated from title if left empty
  • Content: translatable rich text (required for default locale, min 10 characters)
  • Category: select from active categories
  • Status: open / closed / locked (edit only)
  • Pinned: checkbox (edit only)
  • Featured: checkbox (edit only)

Thread Statuses

Status Description
open Thread is active. Users can post replies.
closed Thread is closed. No new replies allowed. Content remains visible.
locked Thread is locked by an admin. No new replies allowed.

Admin: Categories

The Categories page (Forum → Categories) manages the forum’s category hierarchy.

Category List

Shows parent categories with their children, including thread counts. Ordered by the position field.

Create & Edit

The category form includes:

  • Name: translatable (required for default locale, max 100 characters)
  • Slug: translatable, auto-generated if empty (max 120 characters)
  • Description: translatable (max 500 characters)
  • Color: hex color code (e.g. #0891b2) for visual identification
  • Icon class: Bootstrap Icon class (e.g. bi-chat-dots)
  • Parent category: optional, for nesting (one level deep)
  • Position: sort order (integer)
  • Active: toggle switch
Important: Categories with existing threads cannot be deleted. You must reassign or delete all threads in the category first.

Admin: Reported Replies

The Reported Replies page (Forum → Reported Replies) shows all replies that have been flagged by users, ordered by report count (highest first).

Reported Replies Table

Each entry shows:

  • Reply content (preview)
  • Thread link
  • Author
  • Report count
  • Reports: expandable list with reporter name, reason, and details
  • Hidden status

Moderation Actions

Action Effect
Hide Reply Sets is_hidden = true on the reply. Marks all pending reports as “reviewed”. The reply is no longer visible on the front-end.
Unhide Reply Sets is_hidden = false and resets the report count to 0. The reply becomes visible again.
Dismiss Reports Marks all pending reports as “dismissed” and resets the report count to 0. The reply remains visible.
Delete Reply Permanently removes the reply. If it was the best answer, clears the best answer from the thread. Updates the thread’s reply count.
Mark Best Answer Marks the reply as the best answer for its thread (from the admin panel).
Remove Best Answer Removes the best answer designation from the reply.

Front-end: Forum Listing

The main forum page is available at /{locale}/forum (or /forum for the default locale).

Page Layout

The forum listing includes:

  • Category sidebar/filter: all active parent categories with children, clickable to filter threads
  • Sort options: Latest, Popular, Most Replies, Oldest, Unsolved, Solved
  • Thread list: paginated, with pinned threads displayed first. Each thread card shows: title, category badge, author, reply count, view count, last activity, solved/unsolved indicator
  • Statistics sidebar: total threads, total categories, open threads, solved threads
  • Recent threads sidebar: the 5 most recently active threads
  • Popular threads sidebar: the 5 most viewed threads
  • “Start a Discussion” button: navigates to the thread creation page

Sort Options

Sort Value Behavior
latest (default) Order by last activity date, newest first. Pinned threads always appear first.
popular Order by view count, highest first.
replies Order by reply count, highest first.
oldest Order by creation date, oldest first.
unsolved Only threads without a best answer, ordered by last activity.
solved Only threads with a best answer, ordered by last activity.

Front-end: Thread Detail

The thread detail page is available at /{locale}/forum/{slug}.

Page Content

  • Thread header: title, author info, category badge, creation date, view count
  • Thread body: full HTML content (translatable)
  • Voting controls: upvote/downvote buttons with current score (AJAX)
  • Best answer badge: shown if a best answer is selected
  • Replies list: paginated, with best answer pinned to top. Each reply shows: content, author, vote controls, timestamp, nested child replies
  • Reply form: text area for posting a new reply (with optional CAPTCHA)
  • Locked thread notice: if the thread is closed/locked, a message replaces the reply form

View Count

Each time a user visits the thread detail page, the view_count is incremented. This counter is not deduplicated per session: every page load counts.

Front-end: Creating Threads

The thread creation form is available at /{locale}/forum/create.

Access Control

  • If guests_can_create is disabled (default), unauthenticated users are redirected to the login page.
  • If the Envato add-on is active and envato_forum_require_purchase is enabled, the form includes a purchase selector dropdown.

Form Fields

  • Category: required, select from active categories
  • Title: translatable (required for default locale, 5–200 characters)
  • Content: translatable (required for default locale, min 10 characters)
  • CAPTCHA: shown if CAPTCHA is enabled for the forum

On successful submission, the user is redirected to the new thread’s detail page.

Front-end: Replies

Posting a Reply

Authenticated users can post replies using the form at the bottom of the thread detail page. The reply form supports:

  • Content: plain text (2–10,000 characters)
  • Parent reply: optional, for nested replies (clicking “Reply” on an existing reply sets the parent_id)
  • CAPTCHA: shown if CAPTCHA is enabled for the forum

Reply Threading

Replies support one level of nesting. Root replies are displayed in order (best answer first, then by creation date). Child replies (responses to a reply) are shown nested under their parent.

After Posting

When a reply is posted:

  1. The reply is created in the database.
  2. The thread’s reply_count is updated.
  3. The thread’s last_activity_at timestamp is updated.
  4. Notifications are sent (if enabled): to the thread author, and to the parent reply author (for nested replies).

Front-end: Voting

When voting is enabled (forum_voting_enabled), users can upvote (+1) or downvote (-1) threads and replies via AJAX.

Voting Behavior

  • New vote: creates a vote record with value +1 or -1.
  • Same vote again: removes the vote (toggle off). Clicking upvote twice removes the upvote.
  • Different vote: changes the existing vote (e.g. upvote changes to downvote).
  • Self-voting: prevented by default (allow_self_vote = false). Users cannot vote on their own content.

Vote API Response

Front-end: Best Answer

When best answer is enabled (forum_best_answer_enabled), authorized users can mark a reply as the definitive answer to a thread.

Who Can Select

  • Thread author: if forum_author_can_select is enabled.
  • Administrators: if forum_admin_can_select is enabled.

Behavior

  • Only one reply per thread can be the best answer at a time.
  • Marking a new reply as best answer automatically removes the designation from the previous one.
  • The thread’s best_reply_id is updated to point to the selected reply.
  • Best answers are displayed at the top of the reply list on the thread detail page.
  • Threads with a best answer are shown as “Solved” in the forum listing.
  • If a best answer reply is deleted, the best answer is automatically cleared from the thread.

Front-end: Reporting

When reporting is enabled (forum_allow_reporting), authenticated users can report inappropriate replies.

Report Form

  • Reason: required, one of: Spam, Offensive content, Off-topic, Other
  • Details: optional free-text field (max 1,000 characters)

Report Flow

  1. User clicks “Report” on a reply.
  2. If the user has already reported this reply, the action is rejected.
  3. A forum_reports record is created with status pending.
  4. The reply’s report_count is incremented.
  5. If the report count reaches the max_reports_auto_hide threshold, the reply is automatically hidden.
  6. An email notification is sent to administrators (if enabled).

The forum search is available at /{locale}/forum/search?q={query}.

The search uses MySQL’s JSON_SEARCH function to find matches in the translatable title and content JSON columns across all locales. Results are paginated and ordered by last activity date.

Notifications

The forum add-on includes 5 email notification classes, all extending BaseNotification and sent via the mail channel.

Notification Trigger Recipient Setting
NewThreadNotification A new thread is created All admin users forum_notify_admin_on_new_thread
NewReplyNotification A reply is posted on a thread Thread author (skips self-reply) forum_notify_author_on_reply
ReplyToReplyNotification A nested reply is posted Parent reply author (skips self-reply, avoids double-notification with thread author) forum_notify_on_reply_to_reply
BestAnswerNotification A reply is marked as best answer Reply author (skips if marker is the author) forum_notify_on_best_answer
ContentReportedNotification A reply is reported All admin users forum_notify_admin_on_report
Smart deduplication: The ReplyToReplyNotification will not be sent if the parent reply author is also the thread author and the notify_author_on_reply setting is enabled: they already receive the NewReplyNotification in that case.

CAPTCHA Protection

When forum_captcha_enabled is set to true, thread creation and reply forms include CAPTCHA verification using the CAPTCHA provider configured in the core Larapen settings.

Prerequisite: A CAPTCHA provider (e.g., reCAPTCHA, hCaptcha) must be configured in Admin → Settings → General before enabling CAPTCHA for the forum. If no provider is configured, the settings page will show a warning link to the configuration page.

Envato Integration

When the Envato Market Integration add-on is installed, active, and envato_forum_require_purchase is enabled, the forum add-on integrates purchase gating:

  • The thread creation form shows a purchase selector dropdown listing the user’s verified Envato purchases.
  • The StoreThreadRequest validation requires an envato_purchase_id field that must reference a valid, verified purchase owned by the authenticated user.
  • Per-category gating is handled by the Envato add-on’s EnvatoPurchaseValidator: if Envato items are linked to a forum category, only users with a verified purchase of one of those items can create threads in that category.
Note: This integration is optional and has no hard dependency. The forum add-on checks for the Envato add-on’s presence at runtime using addon_active('envato') and class_exists() checks.

Updating

Step 1: Replace Files

Replace the add-on directory with the new version.

Step 2: Run Migrations

Step 3: Clear Caches

Step 4: Verify

Visit Admin → Forum → All Threads to confirm the forum is working correctly. Check the Settings page to review any new configuration options.

Backup first: Always back up your database before running migrations on a production system.

Troubleshooting

Forum pages return 403: “Please login to access the forum”

The forum_guests_can_view setting is disabled. Either:

  • Enable it in Admin → Forum → Settings → Access & Permissions, or
  • Ensure users are logged in before accessing the forum.

Thread creation redirects to login

By default, guests_can_create is false. Unauthenticated users are redirected to the login page. This is expected behavior. Enable guest creation in settings only if needed.

Votes not working: “Voting is not available”

  • Ensure forum_voting_enabled is set to true in settings.
  • If trying to vote on your own content, self-voting is disabled by default (allow_self_vote = false in config/forum.php).
  • Voting requires authentication: guest users cannot vote.

Cannot mark best answer: 403 Forbidden

  • Verify that forum_best_answer_enabled is true.
  • The user must be either the thread author (if forum_author_can_select is enabled) or an admin (if forum_admin_can_select is enabled).

Cannot delete a category: “Cannot delete category with existing threads”

Categories with threads cannot be deleted. Reassign all threads in the category to a different category first (via the admin thread editor), or delete the threads individually.

Reports not auto-hiding replies

  • Check that forum_allow_reporting is enabled.
  • Verify the forum_max_reports_auto_hide threshold: the reply’s report_count must reach this number before auto-hide triggers.
  • Note: a single user can only report a reply once. The threshold requires reports from different users.

CAPTCHA not appearing on thread/reply forms

  • Ensure forum_captcha_enabled is set to true.
  • A CAPTCHA provider must be configured in the core settings (Admin → Settings → General). Without a provider, CAPTCHA fields will not render.

Envato purchase selector not appearing on thread creation

  • The Envato add-on must be installed and active.
  • The envato_forum_require_purchase setting must be enabled in the Envato settings.
  • The user must be authenticated.
  • The user must have at least one verified purchase. If they have no purchases, the selector will be empty.

Notifications not being sent

  • Check that the relevant notification toggle is enabled in Forum → Settings.
  • Verify that mail is properly configured in Admin → Settings → Mail.
  • Self-notifications are suppressed by design: thread authors are not notified of their own replies, and reply authors are not notified when they mark their own best answer.

Search returns no results despite matching content

The search uses MySQL’s JSON_SEARCH function to search within translatable JSON columns. Ensure:

  • The thread content is stored in the expected JSON format (via spatie/laravel-translatable).
  • MySQL 8.0+ is in use (older versions may have limited JSON support).
  • The search query is at least a few characters long: very short queries may not match within JSON values.

Was this article helpful?

Thank you for your feedback!

Still need help? Create a support ticket

Create a Ticket