applications/dashboard/controllers/class.entrycontroller.php
private function RegisterApproval() {
      Gdn::UserModel()->AddPasswordStrength($this);
      
      // If the form has been posted back...
      if ($this->Form->IsPostBack()) {
         
         // Add validation rules that are not enforced by the model
         $this->UserModel->DefineSchema();
         $this->UserModel->Validation->ApplyRule('Name', 'Username', $this->UsernameError);
         $this->UserModel->Validation->ApplyRule('TermsOfService', 'Required', T('You must agree to the terms of service.'));
         $this->UserModel->Validation->ApplyRule('Password', 'Required');
         $this->UserModel->Validation->ApplyRule('Password', 'Strength');
         $this->UserModel->Validation->ApplyRule('Password', 'Match');
         $this->UserModel->Validation->ApplyRule('DiscoveryText', 'Required', 'Tell us why you want to join!');
         // $this->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge');
         
         $this->FireEvent('RegisterValidation');
         
         try {
            $Values = $this->Form->FormValues();
            unset($Values['Roles']);
            $AuthUserID = $this->UserModel->Register($Values);
            if (!$AuthUserID) {
               $this->Form->SetValidationResults($this->UserModel->ValidationResults());
            } else {
               // The user has been created successfully, so sign in now.
               Gdn::Session()->Start($AuthUserID);

               if ($this->Form->GetFormValue('RememberMe'))
                  Gdn::Authenticator()->SetIdentity($AuthUserID, TRUE);
               
               // Notification text
               $Label = T('NewApplicantEmail', 'New applicant:');
               $Story = Anchor(Gdn_Format::Text($Label.' '.$Values['Name']), ExternalUrl('dashboard/user/applicants'));

               $this->EventArguments['AuthUserID'] = $AuthUserID;
               $this->EventArguments['Story'] = &$Story;
               $this->FireEvent('RegistrationPending');
               $this->View = "RegisterThanks"; // Tell the user their application will be reviewed by an administrator.
               
               // Grab all of the users that need to be notified.
               $Data = Gdn::Database()->SQL()->GetWhere('UserMeta', array('Name' => 'Preferences.Email.Applicant'))->ResultArray();
               $ActivityModel = new ActivityModel();
               foreach ($Data as $Row) {
                  $ActivityModel->Add($AuthUserID, 'Applicant', $Story, $Row['UserID'], '', '/dashboard/user/applicants', 'Only');
               }
            }
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
      }
      $this->Render();
   }
private function RegisterApproval() {
      Gdn::UserModel()->AddPasswordStrength($this);
      
      // If the form has been posted back...
      if ($this->Form->IsPostBack()) {
         
         // Add validation rules that are not enforced by the model
         $this->UserModel->DefineSchema();
         $this->UserModel->Validation->ApplyRule('Name', 'Username', $this->UsernameError);
         $this->UserModel->Validation->ApplyRule('TermsOfService', 'Required', T('You must agree to the terms of service.'));
         $this->UserModel->Validation->ApplyRule('Password', 'Required');
         $this->UserModel->Validation->ApplyRule('Password', 'Strength');
         $this->UserModel->Validation->ApplyRule('Password', 'Match');
         $this->UserModel->Validation->ApplyRule('DiscoveryText', 'Required', 'Tell us why you want to join!');
         // $this->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge');
         
         $this->FireEvent('RegisterValidation');
         
         try {
            $Values = $this->Form->FormValues();
            unset($Values['Roles']);
            $AuthUserID = $this->UserModel->Register($Values);
            if (!$AuthUserID) {
               $this->Form->SetValidationResults($this->UserModel->ValidationResults());
            } else {
               // The user has been created successfully, so sign in now.
               Gdn::Session()->Start($AuthUserID);

               if ($this->Form->GetFormValue('RememberMe'))
                  Gdn::Authenticator()->SetIdentity($AuthUserID, TRUE);
               
               // Notification text
               $Label = T('NewApplicantEmail', 'New applicant:');
               $Story = Anchor(Gdn_Format::Text($Label.' '.$Values['Name']), ExternalUrl('dashboard/user/applicants'));

               $this->EventArguments['AuthUserID'] = $AuthUserID;
               $this->EventArguments['Story'] = &$Story;
               $this->FireEvent('RegistrationPending');
               $this->View = "RegisterThanks"; // Tell the user their application will be reviewed by an administrator.
               
               // Grab all of the users that need to be notified.
               $Data = Gdn::Database()->SQL()->GetWhere('UserMeta', array('Name' => 'Preferences.Email.Applicant'))->ResultArray();
               $ActivityModel = new ActivityModel();
               foreach ($Data as $Row) {
                  $ActivityModel->Add($AuthUserID, 'Applicant', $Story, $Row['UserID'], '', '/dashboard/user/applicants', 'Only');
               }
            }
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
      }
      $this->Render();
   }
private function RegisterApproval ( ) { Gdn :: UserModel ( ) -> AddPasswordStrength ( $ this ) ; // If the form has been posted back... if ( $ this -> Form -> IsPostBack ( ) ) { // Add validation rules that are not enforced by the model $ this -> UserModel -> DefineSchema ( ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'Name' , 'Username' , $ this -> UsernameError ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'TermsOfService' , 'Required' , T ( 'You must agree to the terms of service.' ) ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'Password' , 'Required' ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'Password' , 'Strength' ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'Password' , 'Match' ) ; $ this -> UserModel -> Validation -> ApplyRule ( 'DiscoveryText' , 'Required' , 'Tell us why you want to join!' ) ; // $this->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge'); $ this -> FireEvent ( 'RegisterValidation' ) ; try { $ Values = $ this -> Form -> FormValues ( ) ; unset ( $ Values [ 'Roles' ] ) ; $ AuthUserID = $ this -> UserModel -> Register ( $ Values ) ; if ( ! $ AuthUserID ) { $ this -> Form -> SetValidationResults ( $ this -> UserModel -> ValidationResults ( ) ) ; } else { // The user has been created successfully, so sign in now. Gdn :: Session ( ) -> Start ( $ AuthUserID ) ; if ( $ this -> Form -> GetFormValue ( 'RememberMe' ) ) Gdn :: Authenticator ( ) -> SetIdentity ( $ AuthUserID , TRUE ) ; // Notification text $ Label = T ( 'NewApplicantEmail' , 'New applicant:' ) ; $ Story = Anchor ( Gdn_Format :: Text ( $ Label . ' ' . $ Values [ 'Name' ] ) , ExternalUrl ( 'dashboard/user/applicants' ) ) ; $ this -> EventArguments [ 'AuthUserID' ] = $ AuthUserID ; $ this -> EventArguments [ 'Story' ] = & $ Story ; $ this -> FireEvent ( 'RegistrationPending' ) ; $ this -> View = "RegisterThanks" ; // Tell the user their application will be reviewed by an administrator. // Grab all of the users that need to be notified. $ Data = Gdn :: Database ( ) -> SQL ( ) -> GetWhere ( 'UserMeta' , array ( 'Name' => 'Preferences.Email.Applicant' ) ) -> ResultArray ( ) ; $ ActivityModel = new ActivityModel ( ) ; foreach ( $ Data as $ Row ) { $ ActivityModel -> Add ( $ AuthUserID , 'Applicant' , $ Story , $ Row [ 'UserID' ] , '' , '/dashboard/user/applicants' , 'Only' ) ; } } } catch ( Exception $ Ex ) { $ this -> Form -> AddError ( $ Ex ) ; } } $ this -> Render ( ) ; }
Registration that requires approval.

Events: RegistrationPending

@access private
@since 2.0.0
Registration that requires approval .