Title: Pulling user ID
Last modified: August 19, 2016

---

# Pulling user ID

 *  Resolved [daverogers](https://wordpress.org/support/users/daverogers/)
 * (@daverogers)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/)
 * Hi
    I am trying to pull the user id of the person logged in so I can display 
   there user avatar on the home page but cannot seem to get this working. Any Ideas.
   I am using this in a php widget

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891771)
 * You should be able to just use something like
 *     ```
       $current_user = wp_get_current_user();
       $output .= get_avatar( $current_user->ID, 32 );
       return $output;
       ```
   
 * The [Emporium eShop theme](http://quirm.net/emporium/) (currently still in beta)
   includes a custom Login Widget that displays the user avatar. You might want 
   to try downloading that theme and having a look in /library/login-widget.php.
 *  Thread Starter [daverogers](https://wordpress.org/support/users/daverogers/)
 * (@daverogers)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891773)
 * so ie
 *     ```
       <?php
       $current_user = wp_get_current_user();
       $output .= get_avatar( $current_user->ID, 32 )
       return $output;
       ?>
       ```
   
 * Im a bit of a noob at this. BTW Nice themes
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891785)
 * Sort of. It really depends upon what you’re doing within this widget and how 
   it’s set up to generate the final content. The widget I created pours everything
   into a $output variable which is then returned and echoed to the screen. A simpler
   method would be to just use:
 *     ```
       <?php
       $current_user = wp_get_current_user();
       echo get_avatar( $current_user->ID, 32 );
       ?>
       ```
   
 * > BTW Nice themes
 * Thank you. 🙂
 *  Thread Starter [daverogers](https://wordpress.org/support/users/daverogers/)
 * (@daverogers)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891790)
 * Sorry I might not have been clear. Im not creating the widget. What I am doing
   is making an image link <img src=”images/users/<user id here>.jpg”>
    I am using
   a widget which allows php
 *  Thread Starter [daverogers](https://wordpress.org/support/users/daverogers/)
 * (@daverogers)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891793)
 * i cannot thank you enough
    it works perfectly
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891795)
 * Excellent! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Pulling user ID’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/pulling-user-id/#post-1891795)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
