Tagged: code, profile tabs menu buddypress
Hi Beuza,
Can you please give this code a shot?/** * 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_has_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_has_member_type( bp_loggedin_user_id(), 'agent' ) ) { $nav = array(); } return $nav; } add_filter( 'bp_groups_admin_nav', 'buddydev_filter_show_hide_groups_in_adminbar' );
It works with our Member types pro and most probably will work with the other plugin too.
Please make sure to use “agent” like shown below in the member type name.
https://i.imgur.com/JdiZUTa.pngRegards
BrajeshHi Brajesh,
I finally have an issue with the code: member type Player can’t integrate agent’s group. I don’t want group menu tab display in their profile but i would like Players can integrate groups. The goal is to create a kind of agent portfolio for showing to scouts for example.
Could you help me please?
Thanks,Beuza
The topic ‘ [Resolved] Profile tabs depending to user role or member type’ is closed to new replies.
This topic is: resolved