Support » Fixing WordPress » php command for currently logged in user

  • I want to make a customized Dashboard for each user (i only have a few). Is there a way to query php for the name of the currently logged in user? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Mark (podz)


    Support Maven

    From previous answers here about logged in users, you need to query the $User_ID ?

    (I know zero php, hence the vagueness)

    $user_identity is what you want for the name; of course you just need to echo it; <?php _e($user_identity); ?>

    That isnt quite doing it. here is some of the code i am trying to get working…:

    print (“Hi”);
    echo $user_identity;
    print(“<p style=\”font-weight:bold;color:gray;\”>Hope you guys had a good week. Have a better weekend!”);

    this, when executed, just leaves a blank where the user’s id would be.

    Help! Thanks.

    Is that within a WordPress template or on it’s own? If it is on its own you need to include some of the WordPress files first.

    the code above is entered into the custom message field of the dashboard options plugin and evaluated as php. so i suppose it is inserted in the wp-admin index. Is that what you were asking?

    It’s quite possible $user_identity is not a local variable within the scope of the dashboard page; if that’s the case, try making it global and seeing what happens (global $user_identity). I do know I used $user_identity just fine in a custom site template without declaring it global.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘php command for currently logged in user’ is closed to new replies.