Skip to:
Content
Pages
Categories
Search
Top
Bottom

Solved – How to create a link to username/activity in the main menu?


  • kalianey
    Participant

    @kalianey

    Hello, I found this code to add a link to the buddypress profile to the main menu, I would like to know if it is possible to modify it a little to point to mysite.com/membres/#username#/activity instead?

    // Filter wp_nav_menu() to add profile link
    function my_nav_menu_profile_link($menu) { 	
    	if (!is_user_logged_in())
    		return $menu;
    	else
    		$profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('PROFIL') . '</a></li>';
    		$menu = $menu . $profilelink;
    		return $menu;
    }
    
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    The default landing page for member profiles is ‘activity’.
    If you have changed that, remove that code.

    If you need to explicitly set the link to activity for some reason:
    $profilelink = '<li><a href="' . bp_loggedin_user_domain() . '/activity/">' . __('xPROFIL') . '</a></li>';


    kalianey
    Participant

    @kalianey

    Thank you, it works great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar