If no user ID for whatever reason, bail early.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9e21fb42fc
commit
763b0b689e
|
@ -91,6 +91,9 @@ function get_usermeta( $user_id, $meta_key = '') {
|
|||
global $wpdb;
|
||||
$user_id = (int) $user_id;
|
||||
|
||||
if ( !$user_id )
|
||||
return false;
|
||||
|
||||
if ( !empty($meta_key) ) {
|
||||
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
|
||||
$metas = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
|
||||
|
|
Loading…
Reference in New Issue