/** * Before Save Addons * * @return type */ public function beforeSave($insert) { if ($insert) { if ($this->auth_mode == '') { $passwordAuth = new \humhub\modules\user\authclient\Password(); $this->auth_mode = $passwordAuth->getId(); } if (Yii::$app->getModule('user')->settings->get('auth.allowGuestAccess')) { // Set users profile default visibility to all if (Yii::$app->getModule('user')->settings->get('auth.defaultUserProfileVisibility') == User::VISIBILITY_ALL) { $this->visibility = User::VISIBILITY_ALL; } } $this->last_activity_email = new \yii\db\Expression('NOW()'); if ($this->status == "") { $this->status = self::STATUS_ENABLED; } } if ($this->time_zone == "") { $this->time_zone = Yii::$app->settings->get('timeZone'); } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { return parent::beforeSave($insert); }
/** * Before Save Addons * * @return type */ public function beforeSave($insert) { if ($insert) { if ($this->auth_mode == "") { $this->auth_mode = self::AUTH_MODE_LOCAL; } if (\humhub\models\Setting::Get('allowGuestAccess', 'authentication_internal')) { // Set users profile default visibility to all if (\humhub\models\Setting::Get('defaultUserProfileVisibility', 'authentication_internal') == User::VISIBILITY_ALL) { $this->visibility = User::VISIBILITY_ALL; } } $this->last_activity_email = new \yii\db\Expression('NOW()'); // Set Status if ($this->status == "") { if (\humhub\models\Setting::Get('needApproval', 'authentication_internal')) { $this->status = User::STATUS_NEED_APPROVAL; } else { $this->status = User::STATUS_ENABLED; } } if (\humhub\models\Setting::Get('defaultUserGroup', 'authentication_internal')) { $this->group_id = \humhub\models\Setting::Get('defaultUserGroup', 'authentication_internal'); } } if ($this->time_zone == "") { $this->time_zone = \humhub\models\Setting::Get('timeZone'); } if ($this->group_id == "") { throw new \yii\base\Exception("Could not save user without group!"); } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { if ($insert) { $this->url = UrlValidator::autogenerateUniqueSpaceUrl($this->name); } if ($this->url == '') { $this->url = new \yii\db\Expression('NULL'); } else { $this->url = mb_strtolower($this->url); } return parent::beforeSave($insert); }