• Resolved cyberlp23

    (@cyberlp23)


    Hello,
    How can I add the first name of the user after the welcome message widget on the admin dashboard: “Welcome to WordPress [user first name] !”.
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter cyberlp23

    (@cyberlp23)

    Thanks for your answer. Well I don’t want to add a whole new widget.

    I already have done that, it works, and just wish to include the user name.

    function custom_add_dashboard_widgets() {
        wp_add_dashboard_widget( 'custom_dashboard_welcome', 'Welcome', 'custom_add_welcome_widget' );
    }
    function custom_add_welcome_widget(){
    get_currentuserinfo();
    $firstname=$current_user->user_firstname;
    ?>
    Welcome <?php echo $firstname; ?>
    <?php }
    add_action( 'wp_dashboard_setup', 'custom_add_dashboard_widgets' );

    The widget is displayed properly but not the user name.

    Thread Starter cyberlp23

    (@cyberlp23)

    haha, I just forgot the:
    global $current_user;
    before get_currentuserinfo();
    it works now!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add username after "Welcome" on the dashboard’ is closed to new replies.