Skip to content

Instantly share code, notes, and snippets.

@imath
Created June 12, 2016 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/d50ffad10d13616d6d307bb7bdc3877b to your computer and use it in GitHub Desktop.
Save imath/d50ffad10d13616d6d307bb7bdc3877b to your computer and use it in GitHub Desktop.
Snippet to disable the main purpose of BP Reactions to only keep the emoji autocomplete
<?php
/**
* If you don't know how to create/use the bp-custom.php file, please read:
* https://codex.buddypress.org/themes/bp-custom-php/
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* This is just crazy imho!
*
* Doing the following you are not using the plugin for its real purpose
* but only keep the activity emoji autocomplete..
*/
function do_not_use_the_plugin_for_its_real_purpose() {
if ( ! function_exists( 'bp_reactions' ) ) {
return;
}
// Force favorite to be handle by BuddyPress
bp_reactions()->disable_fav_replace = 1;
// Avoid registering reactions
remove_action( 'bp_init', 'bp_reactions_register_default_reactions', 1 );
// Do not register activity actions
remove_action( 'bp_register_activity_actions', 'bp_reactions_register_activity_actions' );
// Stop trying to update the reaction count/delete reactions on activity delete
remove_action( 'bp_activity_after_delete', 'bp_reactions_update_activity_reactions', 10, 1 );
// Do not add the react button
remove_action( 'bp_activity_entry_meta', 'bp_reactions_button' );
// Do not add the reactions container
remove_action( 'bp_before_activity_entry_comments', 'bp_reactions_container' );
// Do not add the reactions user nav
remove_action( 'bp_activity_setup_nav', 'bp_reactions_setup_subnav' );
// Do not add the popular tab
remove_action( 'bp_before_activity_type_tab_friends', 'bp_reactions_activity_directory_tab' );
}
add_action( 'bp_include', 'do_not_use_the_plugin_for_its_real_purpose' );
function do_not_load_not_needed_css() {
wp_dequeue_style( 'bp-reactions-style' );
}
add_action( 'bp_reactions_enqueued', 'do_not_load_not_needed_css' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment