hiding groups and forums from members page
-
Hello,
I am trying to hide the groups and forums tabs from all users except admin and the logged in users own profile. The slugs i want to hide are
/members/betauser/forums/
/members/betauser/groups/I am writing the code as shown below to get this to work but it seems i am always using the logged in user to create the /members/xxx slug where as i may need the user that was clicked.. Any ideas on what i am doing wrong here?
add_action( 'bp_actions', 'RECN_CUSTOM_MEMBER_REMOVE_SUBNAV' ); function RECN_CUSTOM_MEMBER_REMOVE_SUBNAV() { bp_core_add_message(' ok i222n the mnethod','error'); if(is_super_admin() || bp_is_my_profile()) { bp_core_add_message(' ok in the mnethod 1','error'); return; } $hide_tabs = array( 'forums'=>1, 'groups'=>1, ); $username = bp_core_get_username( bp_loggedin_user_id() ); //$parent_nav_slug =bp_get_members_root_slug() . '/' . $username; $parent_nav_slug =bp_get_members_root_slug(); bp_core_add_message(' ok in the mnethod 2'.$parent_nav_slug,'error'); foreach ( array_keys( $hide_tabs ) as $tab ) { bp_core_remove_subnav_item( $parent_nav_slug, $tab ); } if ( ! empty( $hide_tabs[ bp_action_variable( 0 ) ] ) ) { bp_core_add_message( 'Sorry buddy, but this part is restricted to super admins!', 'error' ); bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) ); } }
Thanks,
Parag Bhagwat
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘hiding groups and forums from members page’ is closed to new replies.