Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove add friend button for member type


  • browserco
    Participant

    @browserco

    Hi, I want to remove the ‘add friend’ button for a specific member type in my buddypress site. I don’t want them to have friend requests from anyone.

    I tried to write this code but it does not work:

    function remove_bp_add_friend_button(); {

    $member_type = bp_get_member_type( bp_displayed_user_id() );

    if ( ‘business’ === $member_type ) {
    ‘remove_bp_add_friend_button’;
    }
    }

    Anyone can help with this?

Viewing 6 replies - 1 through 6 (of 6 total)

  • browserco
    Participant

    @browserco

    hello? please kindly help me with this. I want to remove/hide for my specific member type.


    Henry Wright
    Moderator

    @henrywright

    Try this:

    function browserco_filter_add_friend_button( $button ) {
        $member_type = bp_get_member_type( bp_displayed_user_id() );
        if ( 'business' !== $member_type ) {
            return $button;
        }
        return "";
    }
    add_filter( 'browserco_filter_add_friend_button', 'bp_get_add_friend_button' );

    browserco
    Participant

    @browserco

    Thanks @henrywright, but I can still see ‘add friend’ button on profile and directory for this member type. Any other solution?


    bruce30
    Participant

    @bruce30

    hi @browserco ., did you try to uncheck the Friend Connection under the Buddypress component?
    if not. Go to admin dashboard, go to settings, click buddypress,. and under components you can see there the Friend Connections try to uncheck it., i hope this is what you mean and this will help you. 🙂


    browserco
    Participant

    @browserco

    hi @bruce30, thanks for your help 🙂 However, i don’t want to completely remove the ability for friend connections I just don’t want certain members to have friends. I guess I will have to leave this issue as is. It really is a bummer that buddypress devs cannot provide code that help us add/remove features for different member types. What is the point of member types function if members still have same abilities?


    Henry Wright
    Moderator

    @henrywright

    Oops, my apologies. This should work:

    function browserco_filter_add_friend_button( $button ) {
        $member_type = bp_get_member_type( bp_displayed_user_id() );
        if ( 'business' !== $member_type ) {
            return $button;
        }
        return "";
    }
    add_filter( 'bp_get_add_friend_button', 'browserco_filter_add_friend_button' );
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove add friend button for member type’ is closed to new replies.
Skip to toolbar