mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Don't treat a numeric user name as an id.
git-svn-id: https://develop.svn.wordpress.org/trunk@3310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -114,18 +114,22 @@ class WP_User {
|
||||
var $roles = array();
|
||||
var $allcaps = array();
|
||||
|
||||
function WP_User($id) {
|
||||
function WP_User($id, $name = '') {
|
||||
global $wp_roles, $table_prefix;
|
||||
|
||||
if ( empty($id) )
|
||||
if ( empty($id) && empty($name) )
|
||||
return;
|
||||
|
||||
if ( is_numeric($id) ) {
|
||||
$this->data = get_userdata($id);
|
||||
} else {
|
||||
$this->data = get_userdatabylogin($id);
|
||||
if ( ! is_numeric($id) ) {
|
||||
$name = $id;
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
if ( ! empty($id) )
|
||||
$this->data = get_userdata($id);
|
||||
else
|
||||
$this->data = get_userdatabylogin($name);
|
||||
|
||||
if ( empty($this->data->ID) )
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user