コード例 #1
0
ファイル: Users.php プロジェクト: AndreyTepaykin/Platform
 /**
  * Returns a user in the database that corresponds to the contact info, if any.
  * @method userFromContactInfo
  * @static
  * @param {string} $type Could be one of "email", "mobile", "email_hashed", "mobile_hashed", "facebook", "twitter" or "token"
  * @param {string} $value The value corresponding to the type. If $type is:
  *
  * * "email" - this is one of the user's email addresses
  * * "mobile" - this is one of the user's mobile numbers
  * * "email_hashed" - this is the standard hash of the user's email address
  * * "mobile_hashed" - this is the standard hash of the user's mobile number
  * * "facebook" - this is the user's id on facebook
  * * "twitter": - this is the user's id on twitter
  * * "token": - this is the invitation token
  *
  * @return {Users_User|null}
  */
 static function userFromContactInfo($type, $value)
 {
     $ui = Users::identify($type, $value, null, $normalized);
     if (!$ui) {
         return null;
     }
     $user = new Users_User();
     $user->id = $ui->userId;
     if (!$user->retrieve()) {
         return null;
     }
     $user->set('identify', $ui);
     return $user;
 }