Carp Talk (@gloopy)

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • @gloopy

    Participant

    For anyone looking for a better and easier way to do this, i just added this to header.php after the

    							<?php if ( is_user_logged_in() ) { ?>
                
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>" >My Account</a>
                    <ul class='sub-menu'>
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>replies" >My replies</a></li>
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>topics" >My topics</a></li>
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>favorites" >My favorites</a></li>
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>subscriptions" >My subscriptions</a></li>
    <li><a href="<?php bbp_user_profile_url( bbp_get_current_user_id() ); ?>edit" >Edit profile</a></li>
                    </ul>
                </li>

    It works a treat and i even guessed the edit lol

    @gloopy

    Participant

    Hi guys i have used the code above and it works perfect, one problem i have though is it appears in every menu (3 of them) as shown in the screen shot how do i get it to show only in the top right ?

    Here is the screenshot

    Here is the code i used

    // Filter wp_nav_menu() to profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {
        if (!is_user_logged_in() && $args->menu->slug == 'right-top-nav')
            return $menu;
        else
            $current_user = wp_get_current_user();
            $user = $current_user->user_login ;
            $class = 'sub-menu';
            $profilelink = '
                <li><a href="/forums/users/' . $user . '/">My Account</a>
                    <ul class=' . $class . '>
                        </li><li><a href="/forums/users/' . $user . '/replies">My Replies</a></li>
                        <li><a href="/forums/users/' . $user . '/topics">My Topics</a></li>
                        <li><a href="/forums/users/' . $user . '/subscriptions">My Subscriptions</a></li>
                        <li><a href="/forums/users/' . $user . '/edit">Edit My Profile</a></li>
                    
                
            ';
            $menu = $menu . $profilelink;
            return $menu;
     
    }<code></code>

    @gloopy

    Participant

    Hi guys i have used the above code but the profile link appears in every menu. How do i add it to just the top menu ?

    @gloopy

    Participant

    @kaliceos you sir are a legend 🙂

    In reply to: Search not working

    @gloopy

    Participant

    I was using a woothemes template which caused me no end of errors. I actually just changed the theme as i could not be bothered with the headaches

Viewing 5 replies - 1 through 5 (of 5 total)