BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 38
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 38
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 38
    This reply has been marked as private.
  • Participant
    Level: Enlightened
    Posts: 38

    Hi Brajesh,

    Thank you so much for your help. Unfortunatly for me, it doesn’t work. “Groups” nav continu to appear in all type of member profile. Do you want some access to see more?
    I pasted it in my bp-custom.php but nothing new happened:

    /**
    * Remove groups from user profile based on member type.
    */
    function buddydev_remove_group_based_on_member_types() {
    if ( ! bp_is_user() ) {
    return;
    }

    $user_id = bp_displayed_user_id();

    if ( ! bp_get_member_type( $user_id, ‘agent’ ) ) {
    bp_core_remove_nav_item( ‘groups’ );
    }

    }

    add_action( ‘bp_setup_nav’, ‘buddydev_remove_group_based_on_member_types’, 1001 );
    /**
    * Remove groups from adminbar based on member type.
    *
    * @param array $nav nav items.
    *
    * @return array
    */
    function buddydev_filter_show_hide_groups_in_adminbar( $nav ) {
    if ( ! is_user_logged_in() ) {
    return $nav;
    }

    if ( ! bp_get_member_type( bp_loggedin_user_id(), ‘agent’ ) ) {
    $nav = array();
    }

    return $nav;
    }

    add_filter( ‘bp_groups_admin_nav’, ‘buddydev_filter_show_hide_groups_in_adminbar’ );

    Regards,
    Beuza