Tagged: ,

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #708735

    using this:

    add_action('ava_inside_main_menu', 'avia_add_forms_on_header');
    function avia_add_forms_on_header() {
     echo '<span class="avia-bullet"></span><span class="avia-menu-text" style="font-size: 8px; position: relative; width: 100px;">LOGGED IN AS: EDWARD</span>';
    }
    

    in my child-theme, I am able to get a logged in as statement, but the formatting is all wrong. I want it to look like part of the menu. Is there a better way to do this? Don’t worry about the logic of username. I understand that. I am only concerned about how it looks.
    How-it-looks

    #709354

    Hey ec1warc1,

    Please add following code to Fuctions.php file in Appearance > Editor

    function avia_loggedin_user(){
        $user = wp_get_current_user();
    	if(is_user_logged_in()){
    	$output = "LOGGED IN AS: " . $user->display_name;
    	return $output; 
    	}
    }
    add_shortcode( 'av_user_info', 'avia_loggedin_user' );
    
    function remove_title_attr(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('.loggedin-user').removeAttr('href');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'remove_title_attr');

    Then please go to Appearance > Menu and then check “Screen options” on the top right side and then check “CSS Classes”. After that, add a new Custom Link with # for url and [av_user_info] for navigation label. Then give it a custom CSS class “loggedin-user” and add following code to Quick CSS in Enfold theme options under General Styling tab

    .loggedin-user { display: none; }
    .logged-in .loggedin-user { display: block; }

    Best regards,
    Yigit

    #711725

    OMG, it worked….

    One more observations to make this solution a little bit better:
    If I click on a different tab of the same browser, then go back to that tab, the “LOGGED IN AS: USERNAME” disappears. Is there something we can do to prevent that from happening?

    Anwyay…. this is an amazing solution and I really thank you!

    #711726

    Wait a minute… I spoke too soon

    #712206

    Hi,

    You are welcome :)

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    Login credentials include:

    • The URL to the login screen.
    • A valid username (with full administration capabilities).
    • As well as a password for that username.
    • permission to deactivate plugins if necessary.

    Best regards,
    Yigit

    #713196

    I want to thank you for your help, as usual… so awesome. Anyway… I will put the instructions in the private data, you can take a look.

    #713215

    As long as I have your attention, can I add another related question… the “logged in as” is rather long. I would like to shorten it up and make it happier by using a smiley like you see here (shown as is, and how it could improve):
    showing now and an improvement with icon

    Again, thank you so much for the assistance. Best wishes, ec1warc1

    #713341

    ok, I was able to get an image in place of the text “Logged in as” – some sizing and styling needs to be considered, but I can do that. The only issue that remaing is why the link disappears from certain pages if you click on a tab of some other site (unfocus?) and then return. The link with the username disappears. Odd behavior considering the fact that that it is true for some pages only. I would bet it has to do with something on the page. <body> tag perhaps.

    #714429

    Hi,

    This css code in the Quick CSS field removes the item.

    .loggedin-user {
        display: none;
    }

    Best regards,
    Ismael

    #714562

    OMG, that fixed it. I just commented out that line and the problem went away. I don’t understand why that line was included in the original instructions. It doesn’t matter now! It works! THANK YOU! SMILES FROM COLOMBIA! CLOSE THIS TICKET!!!!

    #714576

    Hi,

    You are welcome!

    For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
    And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
    For any other questions or issues, feel free to post them here on the forum and we will gladly try to help you :)

    Enjoy your weekend!

    Regards,
    Yigit

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘I want to include a logged in as in the menu’ is closed to new replies.