• Hi all,

    I’m pretty new to wordpress development world ..

    I’m trying to create my first WP plugin..

    I want to select user data to use it in my application..

    I mean , I need to know the current user id to b able to select his email , his name …

    I appreciate any trial to help ..

Viewing 1 replies (of 1 total)
  • Thread Starter darroosh

    (@darroosh)

    I found it ..

    I will write it to help any one find this post !

    something like :

    <?php global $current_user;
          get_currentuserinfo();
    
          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";
    ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • The topic ‘Want to access user data’ is closed to new replies.