Disable Change Email Address?
-
In the settings (general) panel of buddypress, users can change their email address.
How can I remove or disable this?
If needed, I would be willing to use CSS but can’t find the identifier.
-
Sounds like you need to remove the nav item that corresponds to that link.
There’s two menu items that possibly need to be removed. the most common one could be removed with the
bp_core_remove_subnav_item( 'settings', 'general' );
function.Do you also use the WordPress/BuddyPress adminbar?
No, only the actual buddypress profile.
So you could add something like the following to your functions or bp-custom.php:
function venutius_hide_tab() { if ( !is_super_admin() && !bp_is_my_profile() ) { bp_core_remove_subnav_item( 'settings', 'general' ); } } add_action( 'bp_setup_nav', 'venutius_hide_tab', 15 );
added, unfortunately there was no visible change (cleared cache ofc)
it excludes admin users from the removal, so you will need to login as a standard user
:^) i’ll check
tested. sadly, didn’t work
OK let me give it a test and get back to you
Take your time. I’m very thankful to have some help
Update – the following works:
function venutius_hide_tab() { if ( !is_super_admin() ) { bp_core_remove_subnav_item( 'settings', 'general' ); } } add_action( 'bp_setup_nav', 'venutius_hide_tab', 15 );
However it causes a page not found error when you click on Settings, this is due to the removed nav item being the default tab for the settings link. I’m currently trying to find the right code to reset this default.
yep, I figured that would be a problem :’)
it honestly blows my mind that nothing is generally available for wordpress to prevent users changing their email addresses. That seems pretty fundamental
Sorry, I just got back to pc after sleep. I saw a reply but it’s not here. deleted?
That’s wierd, I did post a reply, now it’s gone.
Here it is again:
function venutius_change_profile_settings_edit_tab() { if( bp_is_active( 'xprofile' ) ) : $access = bp_core_can_edit_settings(); $slug = bp_get_settings_slug(); $args = array( 'parent_slug' => $slug, 'subnav_slug' => $slug . '/notifications/', 'screen_function' => 'bp_settings_screen_notification', 'user_has_access' => $access ); bp_core_new_nav_default( $args ); bp_core_remove_subnav_item( 'settings', 'general' ); endif; } add_action( 'bp_actions', 'venutius_change_profile_settings_edit_tab' );
that’s beautiful!!! now I just have to redirect /settings/ to /settings/notifications/
can you add that line in it so it’s all in the same place? (so I don’t have to use plugin)
I can’t believe how amazing this is working
You mean something like this:
function venutius_change_profile_settings_edit_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 ); bp_core_remove_subnav_item( 'settings', 'general' ); endif; } add_action( 'bp_actions', 'venutius_change_profile_settings_edit_tab' );
I actually fixed it. The previous code you said (before this one) was missing a ‘ before the slug notifications so It wasn’t going where it was supposed to. I added the ‘ and it’s working 100%.
I’m so thankful that you took time out of your day to help me. I hope others benefit as well.
I’m not sure if I should create a new thread for this or not, because it’s somewhat related.
There’s a tab called “Email” in the settings. It’s URI is /members/*/settings/notifications/
I would like to redirect it to just /members/*/settings/
Is there something I can add to functions.php to do this?
Again.. Thank you.
So it sounds like you’d want to remove it from the nav, and set your default landing page to be just settings?
I would like to change the link of the Email settings subnav to be the Settings main nav URL.
There should be no removal of nav, just changing the url.
from
/members/*/settings/notifications/ (Email Settings) to
/members/*/settings/ (Overall Settings)
Let me know if it’s still confusing. I’m having a hard time phrasing it better
my concern is that by doing that you risk hiding the email notifications page from your members inadvertently.
It won’t because you helped me change ‘settings’ to the notifications settings page.
/members/*/settings/ takes members to the notifications settings.
It used to take members to change email address, but we changed it 🙂
Not doing anything sketchy O:
So you’d want to remove it then add it again with the new setting, do you still want to call it email?
I would still call it email. I would just be redirecting it to /members/*/settings/
There is no need to add or remove a tab.
Technically, It would be going to the same place.
/members/admin/settings/ and /members/admin/settings/notifications are the same endpoint atm.
The reason why I want to do this is because of a problem with targeting its URL with a wildcard.
The wildcard thinks I want to target:
/members/*/notifications/
instead of
/members/*/settings/notifications/Because the * is assuming /settings/ is part of it.
In any case, doing this should solve the issue
From what I can see, /settings/ actually redirects to /settings/notifications if you redirect notifications to settings the page has nowhere to go and you get a page not found error.
- You must be logged in to reply to this topic.