linkrobins / discussion-banners
Configurable info banners above, below, and between the posts of a discussion.
Package info
github.com/linkrobins/flarum-discussion-banners
Type:flarum-extension
pkg:composer/linkrobins/discussion-banners
Requires
- php: ^8.3
- flarum/core: ^2.0
Requires (Dev)
- flarum/phpstan: ^2.0
- flarum/tags: ^2.0
- flarum/testing: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A Flarum extension that shows configurable info banners on discussion pages. Add as many banners as you like, each in one of four placements:
- Above the discussion, before the first post
- After the first post
- Below the discussion, after the last post
- Between posts, after every Nth post
Every banner has its own on/off switch, an optional small uppercase heading (for example "Info" or "From our sponsor"), HTML content, an optional icon beside the text (an uploaded image or an emoji), an accent color, and a visibility setting: everyone, guests only, or logged-in users only.
Where each banner appears
A banner can run across the whole forum, or only where you want it:
- All discussions, the default
- Only the discussions you choose, picked by searching for them by title (you can also paste a discussion link or ID) or by tag
- All discussions except the ones you choose
Because each banner carries its own text, different discussions can show completely different notices. Add one banner per notice and point each at its discussions.
By default, every banner that matches a discussion is shown, stacked in the order you listed them. Turn on Show only the most specific banner to have the closest match win instead: in each placement, a banner picked for that discussion beats one for its subtag, which beats one for a tag, which beats one shown in every discussion. So a general notice can be replaced in one tag, or in a single discussion, without turning it off elsewhere.
Targeting and visibility are both enforced server side: a banner written for one discussion is never delivered to someone reading another, and content for one audience never reaches a different one. Banners are sent only with the discussion being viewed, so discussion lists carry no banner data at all.
Banners render as a theme-aware card that follows your forum's colors in both light and dark modes. Content HTML is sanitized before display.
Compatibility
This is the 2.x line, for Flarum 2.0. Flarum 1.8 is served by the 1.x line, which no longer gets updates.
Banners also appear on FoF Blog articles: above the article, right after it, and among its comments.
Installation
composer require linkrobins/discussion-banners
Then enable the extension in the admin panel and configure the banners on its settings page.
Updating
composer update linkrobins/discussion-banners php flarum migrate php flarum cache:clear
Updating from 1.0.x keeps your existing banners: the three per-placement banners are converted into the new list on php flarum migrate, each set to appear in all discussions.