• Resolved gravier

    (@gravier)


    Hi,
    I’m new with WordPress (but I know PHP & MySQL) and I don’t know how I can get the user info (for example: the user’s id..).
    I tried to use wp_get_current_user() but it returns ‘Object’.. ?O
    With what function do you get user’s info?

    Thanks,
    (sorry, for my english, I’m French …)

Viewing 3 replies - 1 through 3 (of 3 total)
  • for example: the user’s id

    This:

    <?php global $user_ID; ?>

    should make sure it’s available for whatever you need it for. A number of WordPress vars related to the ‘current’ user are scoped globally, among which are:

    $user_login
    $user_level
    $user_ID
    $user_email
    $user_url
    $user_identity

    Something like:

    $user = wp_get_current_user();

    allows you to access the data for that user thusly:

    $user->user_level
    $user->ID

    Thread Starter gravier

    (@gravier)

    Thanks !
    It works !
    Your post is very helpful ??

    damn everything but user_role, you mean there’s no code to get user_role ?, the role is more important than the capability as far as access goes,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get user’s info’ is closed to new replies.