Skip to content
ernestdefoePublic

About

Postcards: the Flarum discussion list as cards, with covers, the author's avatar over them, tag covers and built-in view counts. · Support & docs: https://ernestdefoe.online

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Postcards

The discussion list as cards. Each discussion's first picture or video is on the front, with the author's avatar sitting on its edge. Below it are the title, tags, a short excerpt, and the reply and view counts.

Free, MIT, for Flarum 2.

The discussion list as masonry cards

What it does

  • Three layouts:
    • Masonry (the default) keeps each picture's own shape.
    • Grid gives every card the same shape.
    • Wide puts one card on each row, with the picture on the left.
    • Phones always get one column with compact covers.
  • The cover is the first picture or video of the first post:
    • a picture in the post, or one uploaded with fof/upload;
    • a YouTube video shows its thumbnail and a play badge. Nothing is fetched to make it.
    • a discussion linked to a movie, show, game, book or album with Marquee shows that title's poster (or its wide backdrop on phones, Grid and Wide), ahead of a picture in the post.
    • A picture inside a spoiler is never used, and neither is spoiler text in the excerpt.
  • Tag covers: upload a cover for any tag. Choose whether it's used only when a discussion has no picture or video of its own, or always, instead of the post's.
    • There's also a forum-wide default cover.
    • If there's no cover at all, the card shows its tag's color and the first letter of the title. A card never shows a broken image.
  • Per tag: turn cards on or off for a tag, and pick its layout.
  • Members choose: a button above the list switches between cards and the classic list. The choice is remembered for each member. Admins can turn the button off, or keep the classic list as the default and offer cards as the option.
  • The whole card opens the discussion, picture included. The author's avatar opens their profile, or the discussion too if you prefer.
  • Excerpts on every card, or only on unread sticky discussions, like Flarum's Sticky setting.
  • View counts built in. Each viewer counts once per discussion per half hour, crawlers and the author don't count, and no IP address is stored.
    • If FoF Discussion Views or michaelbelgium's Discussion Views is enabled, cards show its count and Postcards' own counter stops.
    • Admin → Tools can import their totals.
    • Turn the count off and nothing is counted or stored either.
  • A lead card, if you want one: the pinned sticky discussion, or simply the first, spans the full width. A sticky you've read goes back to its place in the list as a normal card.
  • Works with themes and other extensions:
    • Cards follow your colors and dark mode.
    • Badges, tags and what other extensions add to the list (best answer, polls…) show on the cards.
    • With Discussion Participants, everyone who replied shows in the card's footer.
    • Postcards steps aside on themes that draw their own list (Cascade, Studio, Broadsheet and Warren).

How it stays light

  • The cover and excerpt are picked once, when the first post is saved, and stored. Reading the list parses nothing and costs one extra query per page, whatever the number of discussions.
  • There are no image copies to generate and nothing to regenerate after you install it. Pictures load lazily at their real size.
  • The forum script is about 3.5 KB gzipped.

Install

composer require ernestdefoe/postcards
php flarum migrate
php flarum cache:clear

Enable it in the admin panel. Existing discussions get their covers in the background, 200 at a time.

On a big board, you can also run:

php flarum postcards:rebuild

The view counter forgets who viewed what after an hour, with a scheduled task. Make sure Flarum's scheduler runs (a cron entry for php flarum schedule:run).

Support

Questions and bug reports: ernestdefoe.online.

If Postcards is useful to you, you can buy me a coffee.

About

Postcards: the Flarum discussion list as cards, with covers, the author's avatar over them, tag covers and built-in view counts. · Support & docs: https://ernestdefoe.online

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages