UserEmail::isEmailForUser PHP Method

isEmailForUser() static public method

is an email of the user
static public isEmailForUser ( $users_id, $email ) : boolean
$users_id user ID
$email string email to check user ID
return boolean is this email set for the user ?
    static function isEmailForUser($users_id, $email)
    {
        global $DB;
        foreach ($DB->request("glpi_useremails", "`users_id` = '{$users_id}' AND `email` = '{$email}'") as $data) {
            return true;
        }
        return false;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Is the email set to the current user
  *
  * @param $email
  *
  * @return boolean is an email of the user
  **/
 function isEmail($email)
 {
     if (!isset($this->fields['id'])) {
         return false;
     }
     return UserEmail::isEmailForUser($this->fields['id'], $email);
 }