Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ultimate Member

    (@ultimatemember)

    Hi Soda,

    I am afraid we have not created this functionality in plugin yet. We will discuss as a team and see if we can add this functionality into plugin in a future update.

    Thanks!

    Thread Starter soda.break

    (@sodabreak)

    Hmmm….in which file can I find this code?

    If you can guide me, I want to try reading the Username variable and displaying it on my website.

    thanks,
    Soda

    Mike

    (@bigmikey00)

    @soda.break
    to display the username you can use this {display_name}
    I have a menu item that is set only when user is logged in and it displays this
    {user_avatar_small}{display_name}

    which is the avatar and the user name

    if you do it through menus that works great other wise you would have to do some coding for it to work

    Pete

    (@perthmetro)

    1. install this plugin…
    https://wordpress.org/plugins/linkable-title-html-and-php-widget/
    2. insert this snippet in the above widget text field

    <p  style="margin-bottom:0px;"><?php if (is_user_logged_in()) {
    // user is logged in, say welcome back
    $user = wp_get_current_user();
    echo 'Welcome back '. $user->display_name . ' ';
    } else {
    // user is not logged in
    echo 'Hello Mr. Anonymous!';
    } ?></p>
    
    <p  style="margin-bottom:0px;"><a href="<?php echo wp_logout_url(); ?>">Logout</a></p>

    This is for the sidebar, not the menu, but it might be good enough?

    I would suggest you create a shortcode for current_user_display_name, which could be used together with shortcodes for detecting if the user is logged in or not.

    This will provide you with flexibility of displaying different content depending on the login state.

    If you are already using Shortcodes Ultimate, then the shortcodes are already available to you (su_members, su_guests, su_user).

    Plugin Author Ultimate Member

    (@ultimatemember)

    Thanks for your suggestion 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘User name after login’ is closed to new replies.