Favorite Button — Groups, Tags & Notes

Save pages and models with groups, tags, search and private notes. October CMS 4.4/3.5.

390
  • 1 ratings
  • 1 reviews
  • 366 installations
Free

Product support

Visit this product's website for support.

  • Added on Jul 8, 2018
  • Current version: 2.0.0
  • Platform Compatibility
    v4.x use latest
    v3.x use latest
    v2.x incompatible
    v1.x incompatible
  • Created by

Categories

Favorite Button — Groups, Tags & Notes

Save pages and models with groups, tags, search and private notes. October CMS 4.4/3.5.

Live demo: Save something · Backend: demo / demo · Poll demo. Data resets daily at 04:00 Asia/Shanghai. Pre-sales: <alex@web4theme.com>.

A favorites list people actually return to.

The old favorite button saved an ID and stopped there. Version 2.0 adds the missing half: groups, tags, search and notes — for logged-in users and guests.

Save anything

  • Any CMS page with the favoriteButton component.
  • Any model (RainLab.Blog posts, products, documentation) by class + ID.
  • A stable item_key lets several cards on one page save independently.
  • Works without RainLab.User or RainLab.Blog; both are optional integrations.

Organise it

  • Groups with names and colours.
  • Tags with a comma-separated editor and tag filters.
  • Notes — why did you save this?
  • Search across titles, notes, tags and URLs.
  • Filter by group and tag; counts and empty states included.

Guest and member favorites

Favorites are keyed to the current owner: a signed guest cookie, or the logged-in frontend user. No account is required for the demo or a lightweight reading list. Groups and tags are private to that owner.

Backend

A Favorites list with searchable titles/notes, owner IDs, groups and timestamps. Permission baba.favoritebutton.manage_favorites.

Compatibility

October CMS 4.4 (primary) and 3.5+. PHP 8.0+. No Composer or JavaScript dependencies. All CSS is scoped to .bf-* and .bmf-*. Dark mode and reduced motion supported.

Upgrading from 1.x copies existing favorites into the new tables; old data is not deleted.

Installation via Command Line

php artisan plugin:install BABA.Favoritebutton

Favorite Button — Documentation

Live demo: <https://october.web4theme.com/favorites&gt; · Backend: <https://october.web4theme.com/admin&gt; (demo / demo). Data resets daily at 04:00 Asia/Shanghai. Pre-sales: <alex@web4theme.com>.

Developer documentation for Favorite Button (BABA.Favoritebutton).


1. Requirements

October CMS 4.4.x (primary) · 3.5+
PHP 8.0+
Database MySQL / MariaDB · SQLite
Optional RainLab.Blog and RainLab.User

The plugin no longer hard-requires RainLab.Blog or RainLab.User. If they are installed, the legacy behaviors are attached automatically.


2. Installation

php artisan plugin:install BABA.Favoritebutton

Or copy to plugins/baba/favoritebutton and run:

php artisan october:migrate
php artisan october:util purge manifest
php artisan cache:clear

Version 2.0 creates baba_favorites_items, baba_favorites_groups, baba_favorites_tags and the tag pivot. Existing 1.x rows in baba_favorites_favorites are copied into the new items table.


3. Components

favoriteButton

[favoriteButton]
title = "Design systems that survive a rewrite"
url = "#design-systems"
excerpt = "How to keep a component library useful."
item_key = "demo:design-systems"

Properties:

Property Description
model_class Optional model class. Empty = save the current page.
model_id Optional record ID.
title, url, excerpt, image_url Stored metadata.
item_key Stable key; required when several page buttons share one URL.
showCount Show the total save count.

For a model:

[favoriteButton]
model_class = "RainLab\Blog\Models\Post"
model_id = "{{ :id }}"
title = "{{ post.title }}"
url = "{{ post.url }}"

The button works for guests; no login is required. The owner is a signed cookie token, or the authenticated user when present.

myFavoritePosts

[myFavoritePosts]
itemsPerPage = 100
demoMode = 0

Features:

  • Search across title, notes, excerpt, URL and tags.
  • Filter by group and tag.
  • Per-item group assignment, tag editing and notes.
  • Create groups with a colour.
  • Remove a favorite.
  • demoMode = 1 adds a “Load a sample collection” button (used by the public demo).

The component works for guests and logged-in users. The default partials are default.htm, body.htm.

postUsers (legacy)

Shows logged-in users who saved a target. Requires RainLab.User to resolve profiles. Kept for 1.x template compatibility.


4. Data model

Table Purpose
baba_favorites_items One saved item: owner, item key, target, title/url/excerpt/image, group, notes.
baba_favorites_groups Per-owner group name/colour.
baba_favorites_tags Per-owner tag names.
baba_favorites_favorite_tag Item ↔ tag pivot.

owner_key is an HMAC of user:{id} or guest:{random token}. Guest tokens are stored in an encrypted HttpOnly cookie plus the session. Raw cookies and IPs are not stored.

A unique index on (owner_key, item_key) makes duplicate saves impossible.


5. Security and privacy

  • CSRF is handled by the October AJAX framework.
  • Every save/remove/edit checks the item belongs to the current owner_key.
  • Search and filters use parameter binding.
  • Notes and tags are escaped by Twig.
  • No raw IP addresses or IP geolocation are stored.
  • Guest favorites disappear when the cookie/session is cleared.

For a public demo, reset the database and browser cookie daily; the reference demo does this at 04:00 Asia/Shanghai.


6. Upgrading from 1.x

  1. Back up the database.
  2. Update the plugin.
  3. Run php artisan october:migrate.
  4. Existing favorites are copied to baba_favorites_items; the old table is left untouched.
  5. Legacy favoriteButton, myFavoritePosts and postUsers aliases are preserved.
  6. 1.x used an answer-style ID-only list; 2.0 adds groups, tags and notes but keeps old titles/IDs where possible.
  7. Remove any dependency on RainLab.Blog/User from your composer constraints; they are now optional.

Old favorites without a title may show as Post #123; edit the favorite in the frontend to add a proper title/note.


7. Live demo

<https://october.web4theme.com/favorites&gt;

  • Six article cards with Save buttons.
  • “Load a sample collection” to see groups, tags and notes.
  • Search “design” and filter by group/tag.
  • Backend demo / demo for the Favorites list.

8. Support

Marketplace support forum or <alex@web4theme.com>. Include October CMS version, PHP version and the browser console/network error.

2.0.0

Favorites 2.0: groups, tags, search, notes, guest favorites and a modern backend.

Nov 14, 2026

1.0.5

add post users component

Nov 20, 2018

1.0.4

add views

Nov 20, 2018

1.0.3

Fix the problem that the post id is incorrect

Aug 11, 2018

1.0.2

show favorites count

Aug 10, 2018

1.0.1

Initialize plugin.

Jul 03, 2018

Upgrade Guide — Favorite Button 2.0

Who should upgrade

Everyone on 1.0.x. Version 2.0 adds groups, tags, search and notes, removes the hard RainLab.User dependency, and works for guests without an account.

Breaking changes

  • Requires October CMS 3.5+ or 4.x and PHP 8.0+.
  • The component aliases favoriteButton, myFavoritePosts and postUsers are unchanged.
  • Backend controller URL is now baba/favoritebutton/favorites.
  • The old baba_favorites_favorites table is left as a legacy table; 2.0 reads baba_favorites_items.
  • Old data is copied during migration, not deleted.
  • New permission: baba.favoritebutton.manage_favorites.

Upgrade steps

  1. Backup the database.

  2. Update the plugin.

  3. Run:

    php artisan october:migrate
    php artisan october:util purge manifest
    php artisan cache:clear
  4. Grant baba.favoritebutton.manage_favorites to roles that need the backend list.

  5. Clear the browser’s old favorite cookie if you were testing 1.x.

  6. Save a page/model and verify groups, tags, search and notes.

Data compatibility

  • Existing rows in baba_favorites_favorites are copied into baba_favorites_items with an owner key derived from the user ID.
  • Old rows without a title are labelled from the target class/ID.
  • No old columns are dropped.

Rollback

Restore the database backup and the 1.x plugin files. The new tables can remain; 1.x ignores them.