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

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

Get a setting for a profile.
public static getSetting ( integer $id, string $name ) : string
$id integer Profile id.
$name string Setting name.
Результат string
    public static function getSetting($id, $name)
    {
        return unserialize((string) FrontendModel::getContainer()->get('database')->getVar('SELECT ps.value
                 FROM profiles_settings AS ps
                 WHERE ps.profile_id = ? AND ps.name = ?', array((int) $id, (string) $name)));
    }

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::getSetting