How to get user meta fields that have just been updated?

For anyone else with this issue, the fix was simple. I changed the hook and most importantly, I changed the priority so my action comes later. Default wordpress priority was 10, so I set priority to 11 and it works. add_action( ‘profile_update’, ‘BB_WP_SYNC_update_BB_profile’, 11, 2); And my function changed due to the different hook: function … Read more

Fetch user related data

I use this function on functions.php in all my development websites function imp($a){ echo ‘<pre>’; print_r($a); echo ‘</pre>’; die(); } now just use imp($user); where you are using get_user_meta ($user->ID). you will have all the info about the $user, maybe this will tell you the answer you need… You will find inside an object with … Read more

How to save user meta on custom admin page

update_user_meta($current_user->ID, ‘description’, $_POST[‘user_description’]); in the form processing function will save the bio. I would keep the form action on the same admin page. As for data validation, I don’t see what there is to validate in the first place. It’s just a string – not an email, address or the like that needs to be … Read more

How to pull user/author profile data in a plugin?

If you’re trying to get user data for the displayed profile, you can do it like so: $thisauthor = get_userdata(intval($author)); That’ll return an object filled with everything you need. For instance, if you need the user ID, you can call it like so: $thisauthor->ID I use this extensively on the profiles on my site: http://androidandme.com/user/clark … Read more

Get user_meta values for a user for an array of meta_keys?

get_user_meta() with omitted key argument will return all data for the object. Trying to retrieve metadata selectively is usually pointless optimization from performance point of view, since everything built on Metadata API tends to just query all data anyway and cache it (which in turn object cache plugin makes persistent and snappy).