Add Profile link to WP Custom Nav Menu
-
Is there a way to add a link to the Buddypress user profile?
I have searched and Googled, and can’t find a working solution.
Using BP 1.5 RC1 with WP 3.2.1
Thanks
-
Worth trying this – may work
`<a href="/edit”>Edit Profile`
@valuser
Yeah but that won’t work. You can’t use link tags in WP custom menus, and also can’t use php.Any other suggestions anyone?
@munman, try this `<a href="profile/edit”>Edit Profile`
regards
Google programmatically adding link to WordPress nav it’s not a BuddyPress issue. However, it’s a needed request and I’ll post a code how to over the weekend
change this in header.php:
`
-
false, ‘menu_id’ => ‘nav’, ‘theme_location’ => ‘primary’, ‘fallback_cb’ => ‘bp_dtheme_main_nav’ ) ); ?>
<li id="menu-item" class="menu-item current-menu-item selected”><a href="”>Profile
`
Then add this function to bp-custom.php:
`function remove_ul_bp_nav ( $menu ){
return preg_replace( array( ‘#^- ]*>#’, ‘#
$#’ ), ”, $menu );
}
add_filter( ‘wp_nav_menu’, ‘remove_ul_bp_nav’ );`I want to add, I tried to use WP admin menus and programmatically add the nav but the dynamic nature of a logged in user and the menu did not work. Each person who logs in would have a different url and the wp-nav requires a single url to be saved in the database for that tab.
Hi modemlooper,
I wasn’t able to get this working.
“I want to add, I tried to use WP admin menus and programmatically add the nav but the dynamic nature of a logged in user and the menu did not work. Each person who logs in would have a different url and the wp-nav requires a single url to be saved in the database for that tab.”Does this mean that your code wasn’t successful for you either?
P.S. – the problem is that the link to the BP profile is not working…
Thanks
The code I posted above works but it’s only for BuddyPress 1.5
okay, this code is combined with the code @modemlooper provided, and i found something else that solved the problem of adding the link into the main navigation. hope this works for everybody, worked for me.
functions.php
Code:// adding dynamic profile link whether user is logged in or not
if ( is_user_logged_in() )
{
// Filter wp_nav_menu() to add additional links and other output
function new_nav_menu_items($items)
{
$homelink = ‘<li class="home"><a href="’ . bp_loggedin_user_domain() . ‘">’ . __(‘Profile’) . ‘</a></li>’;
$items = $homelink . $items;
return $items;
}
add_filter( ‘wp_nav_menu_items’, ‘new_nav_menu_items’ );
}I created a plugin that adds user nav to end of WP menu. It’s in the WordPress.org repo
The plugin doesn’t work for me, it scatters all the links into the header. The scripts shown here work but I get an “error on page” in IE. I’m running the latest buddypress/wordpress with BP-Columns. Any thoughts?
My code was Bly tested on bp-default theme if you have a custom theme you may need to edit CSS or markup
oh, I’m an idiot. I didn’t patch in the right text for the plugin in header.php as described in the install instructions. Thanks for the plugin! Very useful!
Hi, sorry to bother you again. All my current dropdowns align to the right of their parent, and these new ones align to the left. I’d like to re-align one or the other. Can you point me in the right direction?
The BuddyPress Custom Profile Menu plugin should really help you out with this: https://wordpress.org/extend/plugins/buddypress-custom-profile-menu
(full disclosure: it’s our plugin )
@sensibleplugins I want a copy of the pro version for testing purposes and if it works correctly I will give you a good testimonial on your site. Let me know if your willing to let me test it?
@shawn38 We really appreciate your offer, but we’d then have to do the same to all users who ask and it wouldn’t be fair to anyone who had bought the Pro version. Having said that, the free version does provide an excellent venue for you to test the bulk of the plugin’s functionality.
Thanks for understanding
Edit:
I am not trying to personally attack you but there is a pecking order and you have not earned the right to charge for a plugin yet. I program stuff like this while I am asleep so I have no use of your code other than testing it so non-programmers may benefit. People I respect are @mercime @hnla @r-a-y @djpaul @boonebgorges @johnjamesjacoby They never charge for helping a soul.
Your a developer just like me so please do not use the word “we” to address me. You are an individual trying to sell a single plugin with with no credentials at all so don’t mislead people into thinking your some big corporation by using that word. Its condescending to speak to a fellow developer in that manner. @modemlooper has already made plugins free of charge and he has a ton of experience more than I have, and probably more than you as well. His plugins are solid so I am inclined to give links here for the sake of open source:
This is a awesome plugin for free:
https://wordpress.org/extend/plugins/buddypress-profile-menu/
This is another awesome plugin for free that allows you to do many things including changing order of buddypress profile items among other things.
https://wordpress.org/extend/plugins/buddypress-extended-settings/
All credit goes to @modemlooper for his dedication and contributions to open source software. @r-a-y also has some awesome plugins that still are functional.People can create any plugin they want and even charge for plugins. However, its in bad taste to find any thread related and post links to a paid plugin. This is what is generally called spam.
I want to point out that I tried your plugin and while it may do as advertised, the method of overriding a template file is bad. You need to learn how BuddyPress creates the user menu. It’s not the same as WP menus. Overriding a template file that places a WP menu into that space is not a good strategy.
@shawn38 – Firstly, thanks for the kind words. Secondly, if someone wants to try and charge for a plugin, they are free to do so. Also, telling someone you’re not trying to attack them, and then attacking them, isn’t going to yield positive results. If you don’t have anything nice or helpful to contribute, it’s best to keep it to yourself, or that you share it outside of these support forums.
(Emailed @shawn38 privately to continue chatting.)
@johnjamesjacoby Its cool. I need a break from all this for a long while. I helped with what I could. I will be absent for awhile. I need a real job anyway and the stress of taking this too seriously has burned me out. I am sorry if I let anyone down.
Hi @modemlooper,
I can’t find your plugin. It’s not available anymore or
it has changed its name?Thank you,
Natalia
@nasive
I suggest trying out:
https://wordpress.org/plugins/bp-direct-menus/Hi @bp-help can you help with that plugin at all?
i know it’s not yours but it looks like the author hasn’t been back in weeks and you seem to be using it.i’m just trying to add a simple menu link to user profiles and added #bpmdcustom#/profile/ which does absolutely nothing.
No worries if not, i’ll keep trying with it!
- The topic ‘Add Profile link to WP Custom Nav Menu’ is closed to new replies.