Removing Settings General tab redirect to Other Tab
-
Greetings,
We are using LDAP to populate and maintain our Buddypress members list, and because of this we don’t want people to be able to change their password or email address via the Settings > General tab. We would like to therefore hide the General tab and have Settings redirect to a different tab instead (preferably Settings > Profile)
I have gone through the forums and have viewed other posts by people dealing with the same issue, specifically this one:
Here’s the code:
function bpex_change_profile_settings_default_tab() { if( bp_is_active( 'xprofile' ) ) : $access = bp_core_can_edit_settings(); $slug = bp_get_settings_slug(); $args = array( 'parent_slug' => $slug, 'subnav_slug' => 'notifications', 'screen_function' => 'bp_settings_screen_notification', 'user_has_access' => $access ); bp_core_new_nav_default( $args ); endif; } add_action( 'bp_actions', 'bpex_change_profile_settings_default_tab' ); function bpex_remove_general_item_on_usermenu() { global $wp_admin_bar; if ( bp_use_wp_admin_bar() ) { $wp_admin_bar->remove_node( 'my-account-settings-general' ); } } add_action( 'wp_before_admin_bar_render', 'bpex_remove_general_item_on_usermenu' ); function bpex_remove_profile_settings_general_tab() { if( bp_is_active( 'xprofile' ) ) : bp_core_remove_subnav_item( 'settings', 'general' ); endif; } add_action( 'bp_actions', 'bpex_remove_profile_settings_general_tab' );
This seems to be the solution I need, but when I add the code to bp-custom.php it does remove the General tab, but now clicking on Settings generates a 404 error. As this post is over a year old, I’m wondering if there have been changes to Buddypress that stops this from working.
I should mention that I’ve done some (but not a lot) of PHP programming. I did have a co-oworker who is quite proficient at PHP look over this with me, but everything we tried failed to work.
Thanks for any help anyone can give.
- You must be logged in to reply to this topic.