Skip to content

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, bbp_topic, bbp_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. Since 2.5.3 the default is true only on pages that show reactions: the activity directory and member activity, a single post or page that carries reactions or the [bp_reactions] shortcode, bbPress screens, groups, and BuddyBoss media directories. A shortcode or widget rendered elsewhere loads its own assets, so returning false there does not stop them.

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 and same default as buddypress_reactions_load_styles. The script loads in the footer.


Filters the list of theme template slugs that place activity reactions through the theme’s own hook (bp_activity_before_post_footer_content). Every other theme gets reactions under the activity entry and appended to post content. Add your theme’s template slug when it calls that hook.

The filter runs on after_setup_theme, so it can be added from the theme’s functions.php. Return an array: anything else is treated as an empty list.

apply_filters( 'buddypress_reactions_theme_support', $themes );

The 2.5.2 name buddyPress_reactions_theme_suuport still runs as a deprecated alias and shows a deprecation notice when WP_DEBUG is on. Switch your code to the new name.

Parameters:

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

Example: add support for a custom theme.

add_filter( 'buddypress_reactions_theme_support', 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 board (block, widget and [bp_reactions_board]) has one option list, so a change reaches all three.

Filter Default Description
widget_title The view’s title Standard WordPress widget title filter, for the board widget
shortcode_atts_bp_reactions_board Shortcode defaults Standard WordPress filter for the shortcode’s attributes

The 2.5.2 filters widget_reaction_statistic, widget_reactions_shortcodes and widget_max_reactions were removed with the old Reactions List widget, which is now converted to a board widget on upgrade. Set the period and number of items in the widget instead.