There is a global variable called … $user_id
available on that page. Always.
From user-edit.php
:
$user_id = (int) $user_id;
$current_user = wp_get_current_user();
if ( ! defined( 'IS_PROFILE_PAGE' ) )
define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
if ( ! $user_id && IS_PROFILE_PAGE )
$user_id = $current_user->ID;
elseif ( ! $user_id && ! IS_PROFILE_PAGE )
wp_die(__( 'Invalid user ID.' ) );
elseif ( ! get_userdata( $user_id ) )
wp_die( __('Invalid user ID.') );
Related Posts:
- Can an admin check passwords of registered users?
- Add User meta fields, which only admin can edit
- How to display only logged in user’s post comments in comments area
- How can I access profile Admin Colour Scheme
- remove_action with profile_personal_options
- user-new.php less detailed after WP3.1; how to revert?
- How can I make the user names of commentors clickable links to the user’s profile from the admin comment screen?
- Extending the user profile [closed]
- You do not have permission to access this document on form submit
- What are the standard admin CSS id/class tags?
- Admin Page Redirect
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- How To Remove WordPress Version From The Admin Footer
- Set Default Admin Colour For All Users
- Securing Admin Accounts – Username Discovery
- 3.3: How do you hide the new dashboard welcome panel?
- Appearance->Editor not visible
- Hide update messages from non-admin users?
- Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Admin pages have no content
- Add a custom column in users list page
- Blocking Administrative Access to Authors and Subcribers?
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- wp-admin: Sort users by surname
- How to find out if an wp-admin action edited a file?
- WordPress 3.8 get current admin color scheme
- How to Use Resposive Tables in WordPress ADMIN Pages?
- Add Admin User via SQL
- Can you have the users list pre sorted by specific column?
- How to remove Gravatar from Username column
- I keep getting logged out in Firefox
- Add tabbed menu to admin page
- Getting the different post statuses + count like in edit.php, in a custom submenu page
- How do I enable new account notification emails (to the administrator)?
- How To Create User Specific Admin User Pages?
- Change the Default Pages Menu View in wp-admin
- In administration, how do I display comments of a certain user?
- New users must comment when requesting username
- $user_id vs. is_user_logged_in()
- Conditionally load CSS/JS/PHP in wp-admin if using a mobile device
- How to disable automatic excerpt generation *in admin*?
- Limit Words in Category / Term Description – Admin Panel
- Change top level menu item to point to custom submenu item
- List User order by ID in Descending order (Backend)
- Associating custom submenu item with post type of top level menu item
- Adding text in more than one language (at the same time)
- wp-admin post.php JavaScript Links Not Working
- Super slow admin panel
- Admin Taxonomy Terms – Orderby Term Field
- How do I add an admin notice within javascript in the admin interface for posts?
- Fatal error: Exception thrown without a stack frame in Unknown on line 0
- Hide Pages on Edit Pages based on Capability (edit_others_pages)?
- Hide one admin from another admin
- Unable to Access WP Admin or Login buttons after Migration
- Editors change a permalink on an unpublished post, but only admins change a permalink on a post that has ever been published?
- How Can I Found Admin Directory
- Combine and Minify wp-admin files, also re-write URI’s for CDN
- 500 internal server error on wp-admin only
- Redirect from the dashboard to edit.php if wp_is_mobile() is true
- Keep Logged in Users out of Admin Panel
- Seems that admin_post_{action} does not executing
- Add Custom Script in Other Plugin’s Options page
- Can I host WP-admin locally for a remote blog?
- add_cap for editor but no admin role
- get_current_screen and the WP_Screen class
- Shared account / dual blogging in WordPress
- Is there alternative to WP_List_Table?
- WordPress Brute Force Prevention
- Admin login not working
- Adding and removing columns from the admin pages panel
- Hide admin notice when user profile updated
- How to make sure your admin doesn’t hi-jack you site?
- Redirect admin 403 “Cheatin uh?” admin pages
- php return username of currently viewed author profile
- How to change the descriptive text on the menus admin page?
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- Dynamic WordPress Admin Panel
- How to show a custom notification to a specific user?
- Control Users listed in Users List on dashboard
- How should I change the username of or delete the admin user?
- Prevent Registration Where Role is None?
- Hide top admin panel for non admin and non editors
- Show a list of user posts in the user admin page
- Is it possible to create a custom admin page for users?
- Different role for free and pro users in wordpress without using bbpress
- WordPress User profile page fields missing
- Unable to render Admin Notices
- WordPress login not working
- Admin blank but Admin menu showing
- Lock Display Name To Nickname
- Capability to read/edit page in wp-admin only for administrators
- Problems in migration of WordPress site from local server to the online server
- How to create functions that affect only a specific user
- WYSIWYG editor not in a post editor?
- htaccess and htpasswd
- plugin to upload to youtube via wordpress [closed]
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- Add a user to edit the layout of a site