ElggInstaller::admin PHP Method

admin() protected method

Creates an admin user account
protected admin ( array $submissionVars ) : void
$submissionVars array Submitted vars
return void
    protected function admin($submissionVars)
    {
        $formVars = array('displayname' => array('type' => 'text', 'value' => '', 'required' => TRUE), 'email' => array('type' => 'email', 'value' => '', 'required' => TRUE), 'username' => array('type' => 'text', 'value' => '', 'required' => TRUE), 'password1' => array('type' => 'password', 'value' => '', 'required' => TRUE, 'pattern' => '.{6,}'), 'password2' => array('type' => 'password', 'value' => '', 'required' => TRUE));
        if ($this->isAction) {
            do {
                if (!$this->validateAdminVars($submissionVars, $formVars)) {
                    break;
                }
                if (!$this->createAdminAccount($submissionVars, $this->autoLogin)) {
                    break;
                }
                system_message(_elgg_services()->translator->translate('install:success:admin'));
                $this->continueToNextStep('admin');
            } while (FALSE);
            // PHP doesn't support breaking out of if statements
        }
        // bit of a hack to get the password help to show right number of characters
        $lang = _elgg_services()->translator->getCurrentLanguage();
        $GLOBALS['_ELGG']->translations[$lang]['install:admin:help:password1'] = sprintf($GLOBALS['_ELGG']->translations[$lang]['install:admin:help:password1'], $this->CONFIG->min_password_length);
        $formVars = $this->makeFormSticky($formVars, $submissionVars);
        $this->render('admin', array('variables' => $formVars));
    }