Exemplo n.º 1
0
 public static function createUser($data)
 {
     $profile = new UserProfiles();
     $profile->dob = '1988-11-11';
     $profile->attributes = $data;
     $profile->salt = SecurityUtils::generateSalt($profile->email_id);
     $profile->activation_code = SecurityUtils::generateRandomString(10);
     $profile->registered_ip = SecurityUtils::getRealIp();
     return $profile->save();
 }
Exemplo n.º 2
0
 protected function afterSave()
 {
     if ($this->isNewRecord) {
         $model = new UserProfiles();
         $model->balance = UserProfiles::DEFAULT_BALANCE;
         $model->user_id = $this->getPrimaryKey();
         $model->save(FALSE);
     }
     parent::afterSave();
 }
Exemplo n.º 3
0
 public static function updateUser($profilesModel, $userId)
 {
     if ($profilesModel) {
         $model = new UserProfiles();
         $model->attributes = $profilesModel;
         UserProfiles::model()->delete('user_id=:userId', array(':userId' => $userId));
         $model->save();
         return true;
     }
 }