Skip to:
Content
Pages
Categories
Search
Top
Bottom

Logout then profile in nav


  • CreativeWP
    Participant

    @mevaser

    I am working on this website, I added this code (below) to have the profile redirect to our dashboard using WPML. The nav however is out of order, and I do not know how to arrange this nav.

    So we have Home | About us | Logout | Profile

    The profile is added by the code in the function.php (below), which means it is not arranged by the menu section on the WP. I have a conditional navigation. So when not login, I got Register | Login only. Once I login I have Home | About us |

    So the logout and the profile are added by the code below. How do I arrange it that the logout will be at the end?

    
    	add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) {
        if (!is_user_logged_in())
            return $menu;
        else
            $current_user = wp_get_current_user();
            $user=$current_user->user_login ;
            $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/dashboard' ) . '">' . __('Profile') . '</a></li>';
            $menu = $menu . $profilelink;
            return $menu;
     
    }
    

    Please and thank you,

Viewing 1 replies (of 1 total)

  • Robkk
    Moderator

    @robkk

    i cant think of a way using that function.

    only thing i can think of is putting a custom menu in html where your current menu is

    or just put the login widget into your sidebar since it provides a link to the suers profile , by clcking their username.

    you can also hire a developer to build something custom for you.

    post a job at http://jobs.wordpress.net/

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