Hi there, I have added this code to remove the friendship button, but apparently it has no effect?
//remove friendship button on Single User profile add_action('bp_init','bp_custom_remove_friendship_btn_on_profile'); function bp_custom_remove_friendship_btn_on_profile(){ if ( has_action( 'bp_member_header_actions', 'bp_add_friend_button' ) ) { remove_action( 'bp_member_header_actions', 'bp_add_friend_button', 5 ); } }
https://buddydev.com/snippets/?s=Remove+Friendship+Button&stype=all
Could you supply me with corresponding code for removing the friendship button in members directory?
Thanks!
Regards
CarstenHello Carsten,
Thank you for posting. Please try the following code to hide add friend button in the member’s directory
add_filter( 'bp_get_add_friend_button', function ( $button ) { if ( bp_is_members_directory() ) { $button = array(); } return $button; } );
Please do let me know if it works or not.
Regards
RaviHello Ravi, thank you very much for your help, much appreciated, it’s working perfectly.
I can use the code for hiding the button in members header actions as well, but the only function I can find in BP documentation is
bp_is_user_profile()
which removes the friend button from all of the profile page. Is there a function for the member header action?I can see that there are many approaches to hiding buttons,
add_action
.remove_action
oradd_filter
,return $button;
,'__return_false'
,$display = false;
Is there any systematic approach when choosing method?
Thanks again.
Regards
Carsten
You must be logged in to reply to this topic.