If no user ID for whatever reason, bail early.
git-svn-id: https://develop.svn.wordpress.org/trunk@5847 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e86bf7e19f
commit
2ca236c045
@ -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
Block a user