fof / discussion-templates
Create per-tag templates for new discussions.
Fund package maintenance!
Open Collective
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:flarum-extension
pkg:composer/fof/discussion-templates
Requires
- flarum/core: ^2.0.0
- flarum/tags: *
Requires (Dev)
- flarum/phpstan: ^2.0.0
- flarum/testing: ^2.0.0
Replaces
This package is auto-updated.
Last update: 2025-12-24 00:44:52 UTC
README
A Flarum extension that allows you to create customizable templates for new discussions. Templates can be assigned per tag or set as a default for discussions without tags. Additionally, discussion owners and moderators can set reply templates to guide responses.
Note: This extension is a direct replacement for the abandoned
askvortsov/flarum-discussion-templates. Upgrading from the old version is seamless - simply install this new version and your existing templates and settings will be automatically migrated!
Features
- Tag-Based Templates: Create specific templates for each tag to guide users on what information to include
- Default Template: Set a fallback template for discussions created without any tags
- Reply Templates: Discussion owners can set templates that appear when users reply to their discussions
- Permission System: Granular control over who can manage templates
discussion.manageOwnDiscussionReplyTemplates- Allow users to manage reply templates on their own discussionsdiscussion.manageAllReplyTemplates- Allow users (e.g., moderators) to manage reply templates on any discussion
- Auto-Insert: Templates automatically populate the composer when creating new discussions or can append when tags change
Installation
Install with composer:
composer require fof/discussion-templates php flarum migrate php flarum cache:clear
Setup
Tag Templates
- Navigate to the Tags page in your admin panel
- Click on a tag you want to add a template to
- In the modal, you'll see a "Discussion Template" field
- Enter your template using markdown or BBCode formatting
- Save the tag
Default Template (No Tags)
- Go to the Extensions page in your admin panel
- Find "FoF Discussion Templates" and click settings
- Enter your default template in the "Template for discussions with no tag" field
- You can also enable "Append template when tags change" to update the composer when users modify tags
Reply Templates
For Discussion Owners:
- Navigate to one of your discussions
- Click the three-dot menu and select "Set Reply Template"
- Enter the template you want users to see when replying
- Save
For Moderators:
- Moderators with the appropriate permission can set reply templates on any discussion using the same method
Permissions
Configure permissions in your admin panel under the Permissions page:
- Manage own discussion reply templates: Allows users to set reply templates on discussions they created
- Manage all discussion reply templates: Allows users (typically moderators) to set reply templates on any discussion
Usage
Creating a Discussion
When a user creates a new discussion:
- If a tag is selected and has a template, that template will be inserted into the composer
- If no tags are selected and a default template exists, it will be inserted
- If multiple tags are selected with templates, the primary tag's template takes precedence
Replying to a Discussion
When a discussion has a reply template set:
- The template will appear in the composer when users click "Reply"
- Users can modify or remove the template as needed before posting
Notes
- Templates support markdown and BBCode formatting
- The composer preview is not available in the admin area. To preview formatting, create a test discussion in the forum and copy the formatted content
- Templates are automatically inserted when the composer is opened, but users can freely edit or remove them
Updating
composer update fof/discussion-templates php flarum migrate php flarum cache:clear