Skip to content

Hooks and Filters

The plugin exposes the following action hooks and filters for developers.

Fires after a member successfully adds or changes a reaction.

do_action( 'bp_reactions_after_react', $user_id, $post_id, $post_type, $emoji_id, $is_change );

Parameters:

Parameter Type Description
$user_id int ID of the member who reacted
$post_id int ID of the post or activity item
$post_type string Content type: activity, activity-comment, post, topic, reply
$emoji_id int ID of the emoji from the reactions emoji table
$is_change bool true if the member changed an existing reaction, false for a new one

Example use: award points when a member’s content receives a reaction.

add_action( 'bp_reactions_after_react', function( $user_id, $post_id, $post_type, $emoji_id, $is_change ) {
if ( ! $is_change ) {
// New reaction — do something with $post_id author
}
}, 10, 5 );

Fires after a member removes their reaction.

do_action( 'bp_reactions_after_unreact', $user_id, $post_id, $post_type );

Parameters:

Parameter Type Description
$user_id int ID of the member who removed the reaction
$post_id int ID of the post or activity item
$post_type string Content type

Controls the maximum number of reaction choices shown in the emoji picker for any content type.

apply_filters( 'buddypress_reactions_max_emojis', $max );

Parameters:

Parameter Type Description
$max int Default: 8

Example: allow up to 12 reactions.

add_filter( 'buddypress_reactions_max_emojis', function() {
return 12;
} );

Filters the file path used to render an emoji template. Lets you override a template with a custom file.

apply_filters( 'bp_reactions_emoji_layout', $file_path, $name );

Parameters:

Parameter Type Description
$file_path string Absolute path to the default template file
$name string Template name (without .php)

Controls whether the plugin’s front-end CSS is enqueued.

apply_filters( 'buddypress_reactions_load_styles', $should_load );

Parameters:

Parameter Type Description
$should_load bool Whether to enqueue styles

Example: prevent styles from loading on a specific page type.

add_filter( 'buddypress_reactions_load_styles', function( $should_load ) {
if ( is_single() ) {
return false;
}
return $should_load;
} );

Controls whether the plugin’s front-end JavaScript is enqueued. Same signature as buddypress_reactions_load_styles.


Filters the list of theme slugs that are treated as supported. Add your theme’s template slug to bypass the “unsupported theme” admin notice.

apply_filters( 'buddyPress_reactions_theme_suuport', $themes );

Note: the filter name contains a typo (suuport) — match it exactly in your code.

Parameters:

Parameter Type Description
$themes array Default: ['reign-theme', 'buddyx-pro']

Example: add support for a custom theme.

add_filter( 'buddyPress_reactions_theme_suuport', function( $themes ) {
$themes[] = 'my-custom-theme';
return $themes;
} );

Filters the list of post types that receive default reaction configurations on plugin activation.

apply_filters( 'buddypress_reactions_default_post_types', $post_types );

The stats widgets expose several filters for fine-grained control. These follow the standard widget_* filter convention used by WordPress.

Filter Default Description
widget_title Widget title setting Standard WordPress widget title filter
widget_reaction_statistic 'forever' Time period for the Reactions List widget
widget_reactions_shortcodes Array of shortcode IDs Which reaction set IDs the widget queries
widget_max_reactions 8 Max items shown in the Reactions List widget