Clanbite Points Since 1.3.0 Updated in 1.3.1
class Earned_PopupMost awards happen on the server (a post is saved, a reaction is added) so the browser never hears about them. This class loads a small script that asks GET clanbite-points/v1/recent-awards for the member's newest ledger rows and shows each as one of Clanbite's shared popups (clanbite.toasts, so position and length are the site-wide setting). The wording comes from the message registry (Settings → Points → Messages).
Everything is filterable: see clanbite_points_earned_popup_enabled, clanbite_points_recent_awards_window, clanbite_points_recent_awards_limit, clanbite_points_award_message_vars and clanbite_points_recent_awards, and the browser filters clanbite.points.shouldShowEarnedToast and clanbite.points.earnedToastPayload.
class final
- Full name
Kernowdev\ClanbitePoints\Points\Earned_Popup
Constants
| Name | Value | Description |
|---|---|---|
REST_NAMESPACE | 'clanbite-points/v1' | REST namespace shared with the other Points routes. |
SCRIPT_HANDLE | 'clanbite-points-earned-popup' | Script handle. |
Methods
enabled_for()Whether a member should see the popup.enqueue()Load the popup script for signed-in members.is_available()Whether the popup can work at all: it needs Clanbite's shared popups and message registry (Clanbite 1.5+).is_supported()Whether Clanbite's popups are switched on for the site (the Notifications extension is on).latest_award_id()Highest ledger id for a member (0 when they have none yet).register_rest_routes()Register the recent awards route.register()Register hooks.rest_recent_awards()REST: the signed-in member's newest awards after a ledger id, with ready-to-show wording.
Defined in inc/Points/Earned_Popup.php
Changelog
| Version | Description |
|---|---|
| 1.3.1 | Updated. |
| 1.3.0 | Introduced. |