Title: Getting user id for user-edit.php
Last modified: August 19, 2016

---

# Getting user id for user-edit.php

 *  Resolved [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/getting-user-id-for-user-editphp/)
 * I’m adding an additional meta data field to user profiles. For the user that’s
   currently logged in, it’s a simple thing to use `wp_get_current_user()` to get
   their user id (for associating data within the database). If I’m logged in as
   an admin, however, and editing another user’s profile, I’m not quite sure how
   to get _that_ user’s id (in order to pull and save the correct data).
 * Thoughts? One idea is that I could strip it from the URL, but I feel as though
   it’s a hackish solution and there might be a better one. Thanks!

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

 *  Thread Starter [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/getting-user-id-for-user-editphp/#post-1080856)
 * Upon some serious internal reflection, I was able to deduce the answer (actually,
   it came from [here](http://diso.googlecode.com/svn/wordpress/extended-profile/trunk/extended-profile.php)):
 *     ```
       global $profileuser;
       $user_id = $profileuser->ID;
       ```
   
 * `$profileuser` is apparently a global and rather accessible variable for user
   info.
 *  [option8](https://wordpress.org/support/users/option8/)
 * (@option8)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/getting-user-id-for-user-editphp/#post-1080903)
 * were you able to successfully add in user metadata through the user-edit page?
 * i’m trying to do the same thing, and all the solutions i’ve found involve either
   kludgey plugins or things that add extra tables for their own data. meh.
 * i’ve can set and get the data in my templates like so:
    ` update_usermeta($userId,'
   level',"1"); $UserLevel = get_usermeta($userId,'level');
 * but i’m stuck at being able to see/edit that field in the user edit page.

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

The topic ‘Getting user id for user-edit.php’ is closed to new replies.

## Tags

 * [$user_ID](https://wordpress.org/support/topic-tag/user_id/)
 * [user profiles](https://wordpress.org/support/topic-tag/user-profiles/)
 * [user-edit.php](https://wordpress.org/support/topic-tag/user-edit-php/)
 * [wp_get_current_user](https://wordpress.org/support/topic-tag/wp_get_current_user/)

 * 2 replies
 * 2 participants
 * Last reply from: [option8](https://wordpress.org/support/users/option8/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/getting-user-id-for-user-editphp/#post-1080903)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
