I’m not 100% what you are asking, it seems like several questions? But here goes:
$meta_value = get_user_meta($user_id, $key, $single);
For example:
$first_name = get_user_meta($user_id, 'first_name', true);
As for adding hooks I think this answer might be what you are looking for?
UPDATE
Based on some follow up comments I’ll add:
-
The function
get_user_metavalues($user_ids)
from/wp-includes/user.php
will return an array of user data arrays. -
The function
get_userdata()
retrieves user values usingget_user_metavalues($user_ids)
from/wp-includes/pluggable.php
and returns a user data object. -
User Meta is managed through the generic metadata functions found in
/wp-includes/meta.php
so if you are looking for a SQLJOIN
between wp_users and wp_usermeta you are not likely to find one. That file includes these functions:
add_metadata($meta_type,$object_id,$meta_key,$meta_value,$unique=false)
update_metadata($meta_type,$object_id,$meta_key,$meta_value,$prev_value="")
delete_metadata($meta_type,$object_id,$meta_key,$meta_value="",$delete_all=false)
get_metadata($meta_type,$object_id,$meta_key='',$single=false)
update_meta_cache($meta_type,$object_ids)