Clanbite Points Since 1.3.0 Updated in 1.3.1

class Earned_Popup

Most 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).

class final

Full name
Kernowdev\ClanbitePoints\Points\Earned_Popup

Constants

NameValueDescription
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

VersionDescription
1.3.1Updated.
1.3.0Introduced.