• Resolved Abhishek Prakash

    (@abhishek626)


    Hello friends,
    i’m facing a problem in creating a plugin from get_currentuserinfo(); function. I want when the users logs in than the code should display his/her name. Here is my code which i used

    function $user_identity() {
    global $current_user;
    get_currentuserinfo();
    $user_identity = $current_user->display_name;

    echo ‘Username: ‘ . $current_user->user_login . “\n”;
    echo ‘User email: ‘ . $current_user->user_email . “\n”;
    echo ‘User first name: ‘ . $current_user->user_firstname . “\n”;
    echo ‘User last name: ‘ . $current_user->user_lastname . “\n”;
    echo ‘User display name: ‘ . $current_user->display_name . “\n”;
    echo ‘User ID: ‘ . $current_user->ID . “\n”;
    }

    And i want to call it in my header like if( is_user_logged_in()) {
    echo “Hello, $user_idenity”; }
    else {
    echo “Hello, Visitor”;
    };

    Can you please help in doing so.

The topic ‘I want to create a plugin from wordpress get_currentuserinfo(); function.’ is closed to new replies.