public function save($isNewRecord)
    {
        if ($this->validate()) {
            $user = $this->user;
            $data = [];
            $fn = $user->formName();
            if ($isNewRecord) {
                $data[$fn]['username']    = $this->username;
            }
            $data[$fn]['email']           = $this->email;
            $data[$fn]['password']        = $this->password_new;
            $data[$fn]['change_auth_key'] = $this->change_auth_key;

            $loaded = $user->load($data);
            if ($isNewRecord) {
                $user->scenario = $user::SCENARIO_CREATE;
                $user->status = $user::STATUS_REGISTERED;
                $saved = $user->insert();
            } else {
                $saved = $user->update();
            }
            if ($loaded && $saved) {
                $this->auth_key = $user->auth_key;
                return $saved;
            } else {
                $this->addErrors($user->errors);
            }
        }
        return false;
    }
public function save($isNewRecord)
    {
        if ($this->validate()) {
            $user = $this->user;
            $data = [];
            $fn = $user->formName();
            if ($isNewRecord) {
                $data[$fn]['username']    = $this->username;
            }
            $data[$fn]['email']           = $this->email;
            $data[$fn]['password']        = $this->password_new;
            $data[$fn]['change_auth_key'] = $this->change_auth_key;

            $loaded = $user->load($data);
            if ($isNewRecord) {
                $user->scenario = $user::SCENARIO_CREATE;
                $user->status = $user::STATUS_REGISTERED;
                $saved = $user->insert();
            } else {
                $saved = $user->update();
            }
            if ($loaded && $saved) {
                $this->auth_key = $user->auth_key;
                return $saved;
            } else {
                $this->addErrors($user->errors);
            }
        }
        return false;
    }
public function save ( $ isNewRecord ) { if ( $ this -> validate ( ) ) { $ user = $ this -> user ; $ data = [ ] ; $ fn = $ user -> formName ( ) ; if ( $ isNewRecord ) { $ data [ $ fn ] [ 'username' ] = $ this -> username ; } $ data [ $ fn ] [ 'email' ] = $ this -> email ; $ data [ $ fn ] [ 'password' ] = $ this -> password_new ; $ data [ $ fn ] [ 'change_auth_key' ] = $ this -> change_auth_key ; $ loaded = $ user -> load ( $ data ) ; if ( $ isNewRecord ) { $ user -> scenario = $ user :: SCENARIO_CREATE ; $ user -> status = $ user :: STATUS_REGISTERED ; $ saved = $ user -> insert ( ) ; } else { $ saved = $ user -> update ( ) ; } if ( $ loaded && $ saved ) { $ this -> auth_key = $ user -> auth_key ; return $ saved ; } else { $ this -> addErrors ( $ user -> errors ) ; } } return false ; }
Edit user's profile.
@param boolean $isNewRecord
@return integer|false the number of rows affected, or false if validation fails
Edit user s profile .