Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #773383

    Pretty much what the title says.

    How can I change the secondary menu (login and registration) to show the state of the user?

    Thanks

    #773394

    Hey FlatText,

    Please refer to the following thread:

    https://kriesi.at/support/topic/show-logged-in-status-in-header/

    Let me know if this works.

    Best regards,
    Jordan Shannon

    #773970

    Hello,

    header.php does not have that line. It’s in the helper-main-menu.php line 57.

    When I do paste the is_user_logged_in snippet it’s not doing so correctly. See attached.

    I would like the ‘welcome user’ message to hide the ‘Login’ ‘Registration’ links.

    View post on imgur.com

    #774513

    Hi FlatText,

    That code answered your original question. The other thing you want to do is a next question, now you have to check if user is logged in, hide the links and that already depends on how and where those links are added.
    If you need help with that, please give us a link to your website, we need more context to be able to help you.

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #774531

    Hi,

    Thanks I sorted it out. For anyone who needs it, this is what I changed in /includes/helper-main-menu.php around line 42:

    if(strpos( $headerS['header_secondary_menu'], 'extra_header_active') !== false )
    	{
    	//display the small submenu			                
    	if ( is_user_logged_in() ) {
    			$user = wp_get_current_user();
    			$nav = "<div id='header-welcome'>Welcome <a href='wp-admin/profile.php'>". $user->display_name ."</a></div>";
    			//echo "<div id='header-welcome'>Welcome ". $user->display_name ."</div>";
    	}
    	else {
    			$avia_theme_location = 'avia2';
    			$avia_menu_class = $avia_theme_location . '-menu';
    			$args = array(
    			           'theme_location'=>$avia_theme_location,
    			            'menu_id' =>$avia_menu_class,
    			            'container_class' =>$avia_menu_class,
    			             'fallback_cb' => '',
    			             'container'=>'',
    			             'echo' =>false
    		 );
    	        $nav = wp_nav_menu($args);}
    }
    • This reply was modified 7 years ago by FlatText.
    #774534

    @flattext hopefully you made this changes in a child theme otherwise you will loose the customization with the next theme update

    #774542

    Hi Max,

    Yes, I made the changes to the child theme.

    Thank you.

    #774586

    Hi,
    Thank you for sharing your solution, we will close this now. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Replace 'Login', 'Registration' in secondary menu with logged in username’ is closed to new replies.