コード例 #1
0
ファイル: User.php プロジェクト: ahdail/humhub
 /**
  * Before Save Addons
  *
  * @return type
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if ($this->auth_mode == "") {
             $this->auth_mode = self::AUTH_MODE_LOCAL;
         }
         // Set Status
         if ($this->status == "") {
             if (HSetting::Get('needApproval', 'authentication_internal')) {
                 $this->status = User::STATUS_NEED_APPROVAL;
             } else {
                 $this->status = User::STATUS_ENABLED;
             }
         }
         if (HSetting::Get('defaultUserGroup', 'authentication_internal')) {
             $this->group_id = HSetting::Get('defaultUserGroup', 'authentication_internal');
         }
     }
     return parent::beforeSave();
 }
コード例 #2
0
ファイル: User.php プロジェクト: nomaan-alkurn/thooth
 /**
  * Before Save Addons
  *
  * @return type
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if ($this->auth_mode == "") {
             $this->auth_mode = self::AUTH_MODE_LOCAL;
         }
         if (HSetting::Get('allowGuestAccess', 'authentication_internal')) {
             // Set users profile default visibility to all
             if (HSetting::Get('defaultUserProfileVisibility', 'authentication_internal') == User::VISIBILITY_ALL) {
                 $this->visibility = User::VISIBILITY_ALL;
             }
         }
         $this->last_activity_email = new CDbExpression('NOW()');
         // Set Status
         if ($this->status == "") {
             if (HSetting::Get('needApproval', 'authentication_internal')) {
                 $this->status = User::STATUS_NEED_APPROVAL;
             } else {
                 $this->status = User::STATUS_ENABLED;
             }
         }
         if (HSetting::Get('defaultUserGroup', 'authentication_internal')) {
             $this->group_id = HSetting::Get('defaultUserGroup', 'authentication_internal');
         }
     }
     return parent::beforeSave();
 }