Hi!
As part of moderating new members of my site, the Add Friend/Private Message buttons are hidden on profiles. Simple code snippets used, all good. (I can not code unfortunately)But when visiting a profile, and then viewing the Friends of that user, each member in the list has an “Add Friend” button displayed.
I need to completely hide these buttons, for all users, admin included, permanently.
Is it possible?
Any advice greatly appreciated!
Thanks Ravi,
– Add Friend/Private Message buttons are hidden on profile page using “BP Registration Options” plugin, for new members only, once ‘approved’ those buttons become visible to the user.
– Add Friend button is hidden on members page (for all users) using code snippet:
/** * Hide "Add Friend" button on members list & search results list */ add_filter( 'bp_get_add_friend_button', function ( $button ) { if ( bp_is_members_directory() ) { $button = array(); } return $button; } );
– So I need the similar functionality as the snippet above; simply hide the Add Friend buttons in the Friends list (for all users), but the friends feature is not disabled.
Thanks!
I tried changing the above to:
if ( bp_is_members_directory() || bp_is_friends_component() )
which does hide the Add Friend buttons in the user’s Friends list (which I want), but also unfortunately hides the Add Friend button at the top of the profile (which I don’t want).
Could this be improved on?
Thankyou!
Hello Micael,
Thank you for sharing the code. Please try the following code for hiding Add Friend button in the friends list.
add_action( 'bp_before_friends_loop', function() { add_filter( 'bp_get_add_friend_button', '__return_empty_array' ); } ); add_action( 'bp_after_friends_loop', function () { remove_filter( 'bp_get_add_friend_button', '__return_empty_array', 10 ); } );
Please check.
Regards
Ravi
The topic ‘Can I hide “Add Friend” buttons when viewing Buddypress Profile>Friends?’ is closed to new replies.