Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function beforeSave() {
- var_dump('BeforeSave');
- if(!parent::beforeSave())
- return false;
- if ($this->isNewRecord) {
- var_dump('beforeSave If');
- $this->salt = MSHelper::genRandomString(32);
- $this->password = Yii::app()->getModule('user')->encryptString($this->password, $this->salt);
- $this->activation_key = MSHelper::genRandomString(32);
- $this->date_registered = new CDbExpression('NOW()');
- if(Yii::app()->getModule('user')->requireEmailValidation)
- $this->status = self::STATUS_NOACTIVE;
- }
- return true;
- }
- // sample code
- $model = new User;
- $model->username = 'test';
- $model->password = 'test';
- $model->email = 'test@domain.com';
- $model->save();
Add Comment
Please, Sign In to add comment