walsgit / flarum-discussion-cards
Output of discussions lists in form of cards
Package info
github.com/WalsGit/flarum-discussion-cards
Type:flarum-extension
pkg:composer/walsgit/flarum-discussion-cards
Fund package maintenance!
Requires
- flarum/core: ^1.8.0
- flarum/tags: ^1.8.0
- intervention/image: ^2.7
README
A Flarum extension (Fork of @Dem13n's discussion-cards). Allows you to display discussions in the form of cards, the first image of the first post is used as a preview, if there are no images, a stub is displayed.
This fork adds new features where you can now set custom cards settings per tag page (different default image along with number and width of primary cards).
On the index page (all discussions), if a discussion has multiple tags with their own custom image set, the displayed image will be chosen according to these priority rules:
1. The image of the the highest positioned child primary tag of the highest positioned parent primary tag
2. The image of the highest positioned parent primary tag
3. The image of the secondary tag with the lowest id
4. The general default image
Also it changes how the setting to distinguish between read & unread discussion cards work: now the read discussions are filtered with a grayscale instead of the unread ones. As of 1.2.0 read discussion cards a no longer filtered with a grayscale but have just a lighter title and text.
🆕 As of 1.4.0 (biggest update to date) for better performance purposes, all card images are now resolved and created server side, some CLI commands are introduced (see below) as well as some new features like the possibility to show some of the discussion in the discussion list without cards (Flarum default discussion list).
3rd party extension support
- Until version
1.3.0flarumite/simple-discussion-viewswas supported to show discussion views count on cards (see replacement below) - As of version
1.1.0added support for thev17development/flarum-blogextension. If activated, you can set to use the blog's extension images for blog posts' cards and/or their article summary as preview text on the cards. - As of version
1.2.0added support for theshebaoting/repostextension. If activated, you can set it so that when you click on the cardtitleof a discussion starting with a url, it will open that url, and clicking anywhere else on the card will open the discussion as usual. - As of version
1.3.0added support for themichaelbelgium/flarum-discussion-viewsextension. - As of version
1.4.0added support for thefof/discussion-viewsextension (replacing the abandoned flarumite/simple-discussion-views)
CLI Commands
As of version 1.4.0 new CLI commands have been added to manage card images:
php flarum discussion-cards:migrate-images(runs automatically on update).php flarum discussion-cards:purge-imagesto delete unused or all card images from server.php flarum discussion-cards:regenerate-imagesto regenerate card images or generate missing card images. All details on how to use them can be found in the extension's wiki on github (See Documentation in the Links section below or in the Admin Settings Page). You can also add the--helpflag to each command to list options.
Notes
- Developed and tested on Flarum 1.8.7 (first version released
1.0.0) and last version1.4.0was developed and tested on Flarum 1.8.14. - As of version
1.4.0it requires a Flarum minimum version of 1.8.0. - Thanks to whomever suggested on Discord to use the tags selection component (sorry, we can no longer access the messages on Discord to mention them properly).
- New settings page inspired by
Friends of Flarum's Best Answer Extension. - Additional tags settings based on
@askvortsov's Discussion Templates Extension. - Developed this with the help of AI (mainly ChatGPT, Cody & Gemini).
Installation
Install with composer:
composer require walsgit/flarum-discussion-cards
Updating
💡 If you're updating from version 1.3.0 or earlier TO version 1.4.0 or later not that the discussion-cards:migrate-images command will be automatically run to move and convert old images used for cards to new file structure and format (See changelog of version 1.4.0 for more details).
composer update walsgit/flarum-discussion-cards php flarum migrate php flarum cache:clear