Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'xprofile_filter_profile_group_tabs', 'mar_define_profile_by_role' );
- function mar_define_profile_by_role( $group_names ) {
- global $current_user;
- $user_roles = $current_user->roles;
- $user_role = array_shift($user_roles);
- if ( is_user_logged_in() && bp_is_profile_edit() ) {
- if( $user_role == "writer" ) {
- for ($x=0; $x<=sizeof($group_names); $x++) {
- if ( $x != 2 ) echo $group_names[$x]; //3 is the order number (from 0) of the tab that I need to hide in the profile edit page. This is not the group ID.
- }
- } elseif( $user_role == "publisher" ) {
- for ($x=0; $x<=sizeof($group_names); $x++) {
- if ( $x != 1 ) echo $group_names[$x]; //3 is the order number (from 0) of the tab that I need to hide in the profile edit page. This is not the group ID.
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement