Remove items from the Activity Filter Menu
-
WordPress version: 4.4.2
BuddyPress version: 2.4.3
Site: http://geekslife.com/I’ve managed to remove friendships, new members and other items from the activity section of my site, but I’m struggling to find any documentation or forum posts regarding removing those same items from the activity filter menu:
Can anybody offer some guidance please.
Note: I’ve currently got all activities showing on my site until I find a solution to the menu issue.
-
Use the filter hook:
http://hookr.io/filters/bp_get_activity_show_filters_options/Thanks @shanebp – is there any chance you (or anyone) could please provide a more specific example of how to remove Friendships & New Members from the menu?
I’ve looked over the link provided but I’ll be honest I’m struggling to make much sense of it. I tried adding the following to my functions.php as a starting point but I suspect I’m a long way off getting it to do what I want:
// define the bp_get_activity_show_filters_options callback function filter_bp_get_activity_show_filters_options( $filters, $context ) { // make filter magic happen here... return $filters; }; // remove the filter remove_filter( 'bp_get_activity_show_filters_options', 'filter_bp_get_activity_show_filters_options', 10, 2 );
If you remove a filter, you can’t use it.
Try:
function pauld_bp_get_activity_show_filters_options( $filters, $context ) { if ( 'activity' == $context ) { $remove_these = array('Friendships', 'New Members'); foreach ( $filters as $key => $val ) { if ( in_array( $val, $remove_these ) ) unset( $filters[ $key ] ); } } return $filters; }; add_filter( 'bp_get_activity_show_filters_options', 'pauld_bp_get_activity_show_filters_options', 20, 2 );
That’s fantastic @shanebp – thanks so much for posting that! One quick question – what do the numbers at the end (20, 2) relate to?
pauld_bp_get_activity_show_filters_options', 20, 2 );
Hello @shanebp! I need your help with this
I have been trying to add a filter to my member´s profile page, but nothing I have done seems to work,
I used this code for my members´s activity page..
function pauld_bp_get_activity_show_filters_options( $filters, $context ) {
if ( ‘activity’ == $context ) {
$remove_these = array(‘Friendships’, ‘New Members’);
foreach ( $filters as $key => $val ) {
if ( in_array( $val, $remove_these ) )
unset( $filters[ $key ] );}
}return $filters;
};
add_filter( ‘bp_get_activity_show_filters_options’, ‘pauld_bp_get_activity_show_fi…and it works just fine with it,
I don´t know exactly what I need to change or add to make it work for my member´s profile page.
thanks in advance for your help
- The topic ‘Remove items from the Activity Filter Menu’ is closed to new replies.