Frontend\Modules\Profiles\Engine\Model::getIdByEmail PHP Метод

getIdByEmail() публичный статический Метод

Get profile id by email.
public static getIdByEmail ( string $email ) : integer
$email string Email address.
Результат integer
    public static function getIdByEmail($email)
    {
        return (int) FrontendModel::getContainer()->get('database')->getVar('SELECT p.id FROM profiles AS p WHERE p.email = ?', (string) $email);
    }

Usage Example

Пример #1
0
 /**
  * Get the login/profile status for the given e-mail and password.
  *
  * @param  string $email    Profile email address.
  * @param  string $password Profile password.
  * @return string One of the FrontendProfilesAuthentication::LOGIN_* constants.
  */
 public static function getLoginStatus($email, $password)
 {
     $email = (string) $email;
     $password = (string) $password;
     // get profile id
     $profileId = FrontendProfilesModel::getIdByEmail($email);
     // encrypt password
     $encryptedPassword = FrontendProfilesModel::getEncryptedString($password, FrontendProfilesModel::getSetting($profileId, 'salt'));
     // get the status
     $loginStatus = FrontendModel::getContainer()->get('database')->getVar('SELECT p.status
          FROM profiles AS p
          WHERE p.email = ? AND p.password = ?', array($email, $encryptedPassword));
     return empty($loginStatus) ? self::LOGIN_INVALID : $loginStatus;
 }
All Usage Examples Of Frontend\Modules\Profiles\Engine\Model::getIdByEmail