[Support request] Welcome mesage to logged in user

Home Forums Support [Support request] Welcome mesage to logged in user

Home Forums Support Welcome mesage to logged in user

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

    Hello:

    Is possible to show in a custom link menu a wellcome message to logged in users?

    It would be something like this: Wellcome (User name)……

    Apreciate your help.

    Rafael

    #2375613
    Ying
    Staff
    Customer Support

    Hi Rafael,

    Is possible to show in a custom link menu a wellcome message to logged in users?

    It’s possible to print out a welcome message, but I’m not sure what you mean by showing in a custom link menu.

    Can you explain a bit more?

    #2375622
    Rafael

    I refer to this:

    https://ibb.co/Q8H1Q7T

    In a menu custom link I can decide where to show the user name and the wellcome message.

    RAFael

    #2375632
    Ying
    Staff
    Customer Support

    I see.

    We can create a shortcode to show the user name and activate the shortcode feature in menu using this PHP snippet:

    add_shortcode( 'logged_in_user_name', function() {
        ob_start();
    
    $current_user = wp_get_current_user();
    printf( __( '%s', 'textdomain' ), esc_html( $current_user->display_name ) ) . '<br />';
    
        return ob_get_clean();
    } );
    add_filter('wp_nav_menu_items', 'do_shortcode');

    Then add [logged_in_user_name] shortcode to your menu item:
    10.16.2022-14.38.39

    #2375639
    Rafael

    Excellent, it works!….

    And how can I bold the user name??

    #2375684
    Fernando
    Customer Support

    Hi Rafael,

    That’s odd. It should already be bold with the <b> tag. Can you provide the link to the site in question and share temporary credentials so we can check?

    Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    #2375702
    Rafael

    Done..Thanks a lot….it works fine……………

    #2375703
    Fernando
    Customer Support

    You’re welcome Rafael!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.