Skip to content

A short map of how the plugin is put together, for developers extending or debugging it.

The plugin owns no database tables. It reads BuddyPress xProfile data only, and never writes to BuddyPress tables outside BuddyPress APIs. The birthday value comes from an Extended Profile field of type Date Selector (datebox) or Birthdate. The plugin reads:

  • bp_xprofile_data for member birthday values,
  • bp_xprofile_fields to discover the date field,
  • bp_xprofile_meta for the field’s stored date format.

The one small piece of plugin-owned data is per-member user meta: bb_birthday_hidden (the GDPR opt-out) .

There is a single render class, Widget_Buddypress_Birthdays. Both the widget and the [bp_birthdays] shortcode call it, so any render behaviour is identical across the two. The plugin ships no Gutenberg blocks and no REST API endpoints.

Rendered lists are stored in the WordPress object cache under the group bp_birthdays, keyed by the widget instance (and by viewer for the Friends and Followings modes). The lifetime is the Cache Duration setting (default 30 minutes, clamped to 1 to 1440). The cache is cleared automatically on:

  • profile date-field saves (xprofile_data_after_save),
  • friendship accept, delete, and withdraw,
  • follow and unfollow (when BP Follow is active),
  • user register and delete,
  • widget settings save,
  • a member changing their opt-out,
  • a daily cron flush.

Every widget mode (all members, friends, followers) trims candidates in SQL, ordered by upcoming-birthday proximity, to a bounded pool before the per-member loop runs. The pool size is display count x bb_birthdays_widget_candidate_multiplier (default 4), hard-capped by bb_birthdays_widget_candidate_cap (default 200). Per-member values are batch-primed in one query, and so are the reads the privacy checks make: member meta (opt-out, BuddyPress visibility levels), the viewer’s friendships, and on BuddyBoss the profile visibility rows, resolved in BuddyBoss’s own order (visibility row, then the member’s saved level, then the field default; fields with custom visibility disabled ask BuddyBoss per member). So the data loop costs the same handful of queries whatever the pool size. Before rendering a page the widget primes that page’s users and display names with bp_core_get_user_displaynames() (on BuddyBoss this also warms the profile name and visibility caches), so the avatar alt text, names and links add no queries per row. The one query that still reads every stored value of the birthday field is the candidate query itself: it sorts by month and day computed from the value, and BuddyPress’s profile table has no index on that, so a cold render is a scan of that one field’s rows. The plugin owns no table, so it cannot add one; the object cache keeps warm renders off it. Pagination slices the already-fetched, bounded list rather than paging in SQL.

One daily WordPress cron event is used: bp_birthdays_daily_check runs the birthday processing (emails, activity, notifications, admin summary) at the configured send time. It is scheduled on activation, self-heals if lost, and is cleared on deactivation and uninstall.

The cached birthday lists live in the bp_birthdays object cache group. Every key carries the site’s date and the group’s last-changed token, so the lists roll over at the site’s midnight and are retired together when a profile, friendship or follow changes.

The widget branches on buddypress()->version >= 12.0 to choose between the newer member-URL and slug APIs and their pre-12.0 equivalents, so it works across BuddyPress generations and with BuddyBoss.

The plugin registers no AJAX actions. The send-wishes button is a plain link to the BuddyPress private-message compose screen.