Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created a community by using BuddyPress. Now I want to manage its navigation bar which has these pages My Home , my profile etc..

Actually, I want to put the two pages My Home and My Profile in the main navigation bar. So that the user can access his profile from it.

I tried to edit by creating a menu, but I can see only WordPress pages.

share|improve this question
add comment

2 Answers

You don't say which versions of WP / BP you're using, but try this:

http://wordpress.org/extend/plugins/buddypress-profile-menu/

share|improve this answer
add comment

the plugin mentioned above may give you what you are after, if not, I spent many many many hours figuring out how to add any menu item to to the main navigation bar.

Hope this helps

First ( highly recommend a child theme) add this to functions.php:

//--Current Page URL
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .=      $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

Also add this to functions.php:

//--Nav Menu
 function add_profile_link_to_nav(){ 
if ( is_user_logged_in() ) { ?> 

<ul> 

            <li class="menu-item"id="one"> <a href="<?php echo  bp_loggedin_user_domain() ?>activity/just-me/">My Wall</a>
        <ul class="sub-menu"> 

            <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>activity/friends/">My Friends' Activities</a></li>
            <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>profile/edit/group/1">Edit My Profile</a></li>
   </ul> 
</li>
<!--end menu--->
<!-- new menu here  edit the links-->
<li class="menu-item"id="two"> <a href="http://my_site.com/groups/community-wide-announcements/">Member Announcements</a>
        <ul class="sub-menu"> 

            <li class="menu-item"></li>
   </ul> 
</li>
<!--end menu--->
<!-- new menu here  edit the links-->

<li class="menu-item"id="three"> <a href="http://my_site.com/members/">All Members</a>
        <ul class="sub-menu"> 

            <li class="menu-item"> </li>
   </ul> 
</li>
<!--end menu--->
<!-- new menu here  edit the links-->
<li class="menu-item"id="four"> <a href="http://my_site.com/events/">All Events</a>
        <ul class="sub-menu"> 

            <li class="menu-item"> <a href="http://my_site.com/events-calander/">Calendar View</a></li>
            <li class="menu-item"id="four"> <a href="<?php echo bp_loggedin_user_domain() ?>events/my-events/">My Events</a></li>
            <li class="menu-item"id="four"> <a href="<?php echo bp_loggedin_user_domain() ?>events/my-events/">Create an Event</a></li>
   </ul> 
</li>
<!--end menu--->
<!-- new menu here  edit the links-->
<li class="menu-item"id="five"> <a href="http://my_site.com/groups/">All Groups</a>
        <ul class="sub-menu"> 

            <li class="menu-item"></li>
   </ul> 
</li>
<!--end menu--->
<?php 
} 
}
add_action("bp_nav_items","add_profile_link_to_nav");

Then in header.php find: <?php echo add_profile_link_to_nav(); ?>

and add next to it: <?php do_action('bp_menu') ?>

so that it looks like this:

<?php do_action('bp_menu') ?><?php echo add_profile_link_to_nav(); ?>

Add to header.php before </header> (this adds a active color to the selected menu item link)

<?php

            if ( curPageURL() == bp_loggedin_user_domain().'activity/just-me/') {   $current = 'one'; }
             elseif ( curPageURL() == bp_loggedin_user_domain().'activity/friends/') { $current = 'one'; }
             elseif ( curPageURL() == bp_loggedin_user_domain().'profile/edit/group/1') { $current = 'one'; }

             elseif ( curPageURL() == 'http://my_site.com/members/') { $current = 'two'; }

             elseif ( curPageURL() == 'http://my_site.com/groups/'){ $current = 'three'; }
             elseif ( curPageURL() == bp_loggedin_user_domain().'groups/') { $current = 'three'; }

             elseif ( curPageURL() == 'http://my_site.com/events/') { $current = 'four'; }
             elseif ( curPageURL() == bp_loggedin_user_domain().'events/my-events/') { $current =  'four';}                    

?>

        <style type="text/css">
          #<?php echo $current; ?> {
         background-color: #1E0D51;
         font-family: Comic Sans MS,Comic Sans MS5,cursive;
         }                 } 
        </style>

You wil have to change the above menu to what you want, as is, it is a copy of my menu on one of my bp sites.

As an example the url for my profile is:

http://my_site.com/members/admin/profile/
http://my_site.com/members/admin/profile/public/
http://my_site.com/members/admin/profile/edit/group/1
http://my_site.com/members/admin/profile/change-avatar/

and if you mean "My Home" to be "My Activity"

http://my_site.com/members/admin/activity/just-me/

becomes:

<?php
  if ( curPageURL() == bp_loggedin_user_domain().'activity/just-me/') { $current = 'one'; }
elseif ( curPageURL() == bp_loggedin_user_domain().'profile/') {   $current = 'two'; }
elseif ( curPageURL() == bp_loggedin_user_domain().'profile/public/') { $current = 'two'; }
elseif ( curPageURL() == bp_loggedin_user_domain().'profile/edit/group/1') { $current = 'two'; }
 elseif ( curPageURL() == bp_loggedin_user_domain().'change-avatar/') { $current = 'two'; }
?>

<style type="text/css">
          #<?php echo $current; ?> {
         background-color: #1E0D51;
         font-family: Comic Sans MS,Comic Sans MS5,cursive;
         }                 } 
        </style>

And the Nav becomes

//--Nav Menu
 function add_profile_link_to_nav(){ 
if ( is_user_logged_in() ) { ?> 

<ul> 

            <li class="menu-item"id="one"> <a href="<?php echo  bp_loggedin_user_domain() ?>activity/just-me/">My Wall</a>
        <ul class="sub-menu"> 

<!--end menu--->
<!-- new menu here  edit the links-->
            <li class="menu-item"id="two"> <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>profile/">My Profile</a></li>
            <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>profile/public/">My Public Profile</a></li>
            <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>profile/edit/group/1">Edit My Profile</a></li>
            <li class="menu-item"> <a href="<?php echo bp_loggedin_user_domain() ?>change-avatar/">Change My Avatar</a></li>

   </ul> 
</li>
<!--end menu--->
<?php 
} 
}
add_action("bp_nav_items","add_profile_link_to_nav");

I think thats it, good luck.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.