[Resolved] Profile settings url
-
Hi everyone,
Where can I change the url of the profile settings tab? I’ve searched everywhere but I can’t find it. Instead of /settings I would like to give it another URL.
Thanks a lot!
-
add this to bp-custom.php /plugins/bp-custom.php (i you don’t such file you have to create it first)
define(
'BP_SETTINGS_SLUG'
,
'settings'
);
//Change "settings" to what you want.
You can read here: https://codex.buddypress.org/developer/customizing/customizing-labels-messages-and-urls/
@Chouf1 thanks a lot!! Is it possible to change it to notifications? I want to link that menu item to the notifications
Everything is possible if you know what you want. But you must explain that clearly. 😉
@Chouf1 Haha sorry mate. What i mean is that I want the settings tab in the profile navigation to be linked to /notifications instead of /general. Thats because I disabled the general tab where people can edit their email and change their passwords.
If you click on the settings tab a 404 error page shows up, because the page doesn’t exist. So I thought lets link that page to the notifications straight away.(since that is still possible)
Hope its clear enough.
THanks!
Can you pastebin the code you already made for this ?
@Chouf1 Sure! I put this in my functions.php
//Remove Settings->Notifications SubMenu
function remove_general_subnav(){
global $bp;
if ( $bp->current_component == $bp->settings->slug ) {
bp_core_remove_subnav_item($bp->settings->slug, ‘general’);
}
}
add_action( ‘wp’, ‘remove_general_subnav’, 2 );notifications menu item is subnav dependant and a bit complicated to set.
Anyway, here are 2 functions to make this work a little better as your function.
One removes the setting page to avoid the 404 error
And the other remove the “general > settings” submenu.Will see this week-end how to move “notifications” from sub to top level in the my_account group menu. Also how to get rid of the “settings” menu on the buddy navbar showing above the content.
http://bp-fr.net/BuddyBin/?82cf558c7fc5cc10#/oXAizh+nvupA3fVOfRQ2E9WvEcLyTxRM/f+rv5+DEQ=
Give a try and feedback too ! 😉
Hi @chouf1 Thanks!!!!! Ill wait for your response about the notifications link.
here a better code for doing what you need. Code is commented, so i hope you understand how it works
http://bp-fr.net/BuddyBin/?92674aed1b1c6efc#cEK0nMFiknQS0ozXwkKTOGqANlnGLuQdDIsxLi3cr7E=
@chouf1 It works! Thanks for the effort, I really appreciate it. How can I also add the link to the profile buddypress navigation? It only shows up in the toolbar now.
@Chouf1 Im so sorry mate! I ment in the general navigation menu. A new item called settings.
@Chouf1 Yes it works! Where do I change the css? When I give it another ID in the php it doesn’t work. Example: Your code says css_id= “notif” And in my css I put in #notif, but that doesn’t seem to work.
as is, no, it doesn’t work. 😉
you have to learn a bit on your own. Geting a style element ID is ALWAYS written in the page source code, not absolutly in the function.
Ok thanks mate!
@Chouf1 Sorry, last question. I can’t figure out where the css ID is coming from. I tried to look it up with firebug but the given ID there doesn’t seem to work. Where is the ID created? Not in the function right? (Since I already tried that)
Thanks
sorry there is a little error in my code !
replace ‘css_id’ => ‘notif’,
by ‘item_css_id’ => ‘notif’,css test to use in child theme styles.css
li#notif-personal-li {
font-weight: bold!important;
}ah thats why. Thank you!
@chouf1 I noticed something. The settings link is visible on every profile page.
So if you’re logged in as user 1, you’re able to see the settings link on user 2 his account. Is it possible to show it only on your own account and hide it on other people their account? User 2 is not allowed to see the settings link on user 1 his profile page. Only on his own profile page.
try this
if (bp_is_my_profile( $userid )):
bp_core_new_nav_item(array(bla bla code
) );
endif;@chouf1 Where should I start en end this code exactly? Because when I end the code with the ) );
endif; The line seems to be corrupt.I started the whole function with:
if (bp_is_my_profile( $userid )):
bp_core_new_nav_item(array(“the whole piece of code you gave me”
) );
endif;Is this correct?
- The topic ‘[Resolved] Profile settings url’ is closed to new replies.