public function __construct($user = 0, $name = '', $blog_id = '')
{
$id_user = 0;
// Sanitize $id
if (is_numeric($user)) {
$id_user = $user;
// If zero get the current id user
if (empty($id_user)) {
$id_user = get_current_user_id();
}
} elseif (is_object($user) && isset($user->ID)) {
$id_user = absint($user->ID);
} elseif (is_array($user) && isset($user['ID'])) {
$id_user = absint($user['ID']);
} elseif (is_string($user) && is_email($user)) {
$user = get_user_by('email', $user);
$id_user = $user->ID;
}
parent::__construct($id_user, $name, $blog_id);
// Set the extended property when an user is set
if (!empty($id_user)) {
$this->first_name = $this->get('first_name');
$this->last_name = $this->get('last_name');
$this->nice_name = $this->data->user_nicename;
$this->user_login = $this->data->user_login;
$this->full_name = $this->full_name($this->first_name, $this->last_name);
$this->display_name = $this->data->display_name;
$this->email = sanitize_email($this->data->user_email);
$this->status = $this->get(WPDKUserMeta::STATUS);
$this->statusDescription = $this->get(WPDKUserMeta::STATUS_DESCRIPTION);
// Sanitize string->int
$this->data->ID = absint($id_user);
$this->ID = absint($id_user);
}
}