Database Schema
Database Schema
Section titled “Database Schema”The plugin creates three tables on activation. All table names use the WordPress table prefix (default wp_).
{prefix}bp_reactions_emojis
Section titled “{prefix}bp_reactions_emojis”Stores the available emoji library.
| Column | Type | Description |
|---|---|---|
id |
int AUTO_INCREMENT |
Primary key |
name |
varchar(500) |
Display label (editable via the Emoji Labels tab) |
type |
enum('inbuilt','custom') |
Whether the emoji is built-in or user-created |
format |
varchar(10) |
File format: svg |
On activation the plugin populates this table with 200 built-in emojis. SVG files are stored in the plugin’s emojis/svg/ directory and referenced by ID.
{prefix}bp_reactions_shortcodes
Section titled “{prefix}bp_reactions_shortcodes”Stores named reaction set configurations.
| Column | Type | Description |
|---|---|---|
id |
mediumint(9) AUTO_INCREMENT |
Primary key |
name |
varchar(150) |
Human-readable name (e.g. “Activity Reaction”) |
post_type |
varchar(100) |
Associated content type |
front_render |
int(11) |
1 if this set is rendered on the front end |
options |
longtext |
JSON object of configuration options |
The options JSON can contain: emojis (array of emoji IDs), animation ("true" or "false"), react_icon_animation ("true" or "false"), show_count (bool), show_title (bool), cta_text (string), and shortcode_align (string).
The built-in sets are created on activation:
| ID | Name | post_type |
|---|---|---|
| 1 | Activity Reaction | activity |
| 2 | Activity Comment Reaction | activity_comment |
{prefix}bp_reactions_reacted_emoji
Section titled “{prefix}bp_reactions_reacted_emoji”Records each individual reaction by a member.
| Column | Type | Description |
|---|---|---|
id |
int AUTO_INCREMENT |
Primary key |
post_id |
int |
ID of the content item that was reacted to |
post_type |
varchar(50) |
Content type (e.g. activity, activity-comment, post, topic, reply) |
reacted_to |
varchar(10) |
Reaction target marker recorded with each reaction (shown in the admin Reactions Log) |
user_id |
int |
WordPress user ID of the member who reacted |
emoji_id |
int |
FK to bp_reactions_emojis.id |
bprs_id |
int |
FK to bp_reactions_shortcodes.id |
reacted_date |
datetime |
Timestamp of the reaction (used for widget time-period filters) |
Indexes are on post_id, user_id, and emoji_id to support the count queries efficiently.
One row per member per content item per reaction set. When a member changes their reaction, the existing row is updated in place (emoji_id is overwritten). When they remove it, the row is deleted.
Querying reaction counts
Section titled “Querying reaction counts”global $wpdb;
// Total reactions on one activity post$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}bp_reactions_reacted_emoji WHERE post_id = %d AND post_type = %s AND bprs_id = %d", $activity_id, 'activity', 1) );Data cleanup
Section titled “Data cleanup”If Delete all data on uninstall is enabled in the BP Integration settings, the uninstall routine drops all three tables and deletes all plugin options. This is irreversible.
Related pages
Section titled “Related pages”- Hooks and Filters —
bp_reactions_after_reactfires after each row is inserted or updated - Reactions Log — admin UI for browsing
bp_reactions_reacted_emoji

