Remove add_friend button
-
Hi everyone,
I’m trying to remove add_friend button on members loop only for memebrs who have a certain meta data that we’ll call ‘inactive’.
Here’s my code:
function hideAddFriend(){ $caps = get_user_meta(bp_get_member_user_id(), 'wp_capabilities', true); $roles = array_keys((array)$caps); // Hide friendship buttons if(in_array("inactive", $roles)){ return ; } } add_filter( 'bp_get_add_friend_button', 'hideAddFriend');
The thing is that function make disapear all the add_friend button of all members on the page and not only the ones whose the role is “inactive”.
I m just starting to get how filters work, but I m quiet sure I m close to the solution. I just can’t understand how to specify which button will disapear…
Thanks in advance
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Remove add_friend button’ is closed to new replies.