PHPFusion\UserFieldsInput::saveInsert PHP Метод

saveInsert() публичный Метод

Save User Fields
public saveInsert ( ) : boolean
Результат boolean - true if successful.
    public function saveInsert()
    {
        $settings = fusion_get_settings();
        $locale = fusion_get_locale();
        $this->_method = "validate_insert";
        $this->data = $this->_setEmptyFields();
        if ($this->_userNameChange) {
            $this->_settUserName();
        }
        $this->_setPassword();
        $this->_setUserEmail();
        /**
         * For validation purposes only to show required field errors
         * @todo - look further for optimization
         */
        $quantum = new QuantumFields();
        $quantum->setCategoryDb(DB_USER_FIELD_CATS);
        $quantum->setFieldDb(DB_USER_FIELDS);
        $quantum->setPluginFolder(INCLUDES . "user_fields/");
        $quantum->setPluginLocaleFolder(LOCALE . LOCALESET . "user_fields/");
        $quantum->load_fields();
        $quantum->load_field_cats();
        $quantum->setCallbackData($this->data);
        $fields_input = $quantum->return_fields_input(DB_USERS, 'user_id');
        if (!empty($fields_input)) {
            foreach ($fields_input as $table_name => $fields_array) {
                $this->data += $fields_array;
            }
        }
        if ($this->validation == 1) {
            $this->_setValidationError();
        }
        if (\defender::safe()) {
            if ($this->emailVerification) {
                // Quantum Data is OK
                $this->_setEmailVerification();
            } else {
                /**
                 * Create user
                 */
                dbquery_insert(DB_USERS, $this->data, 'save');
                $this->_completeMessage = $locale['u160'] . " - " . $locale['u161'];
                if (defined("ADMIN_PANEL")) {
                    global $aidlink;
                    require_once LOCALE . LOCALESET . "admin/members_email.php";
                    require_once INCLUDES . "sendmail_include.php";
                    $subject = str_replace("[SITENAME]", $settings['sitename'], $locale['email_create_subject']);
                    $replace_this = array("[USER_NAME]", "[PASSWORD]", "[SITENAME]", "[SITEUSERNAME]");
                    $replace_with = array($this->_userName, $this->_newUserPassword, $settings['sitename'], $settings['siteusername']);
                    $message = str_replace($replace_this, $replace_with, $locale['email_create_message']);
                    sendemail($this->_userName, $this->_userEmail, $settings['siteusername'], $settings['siteemail'], $subject, $message);
                    // Administrator complete message
                    $this->_completeMessage = $locale['u172'];
                    unset($aidlink);
                } else {
                    // got admin activation and not
                    if ($this->adminActivation) {
                        $this->_completeMessage = $locale['u160'] . $locale['u162'];
                    }
                }
            }
            $this->data['new_password'] = $this->_getPasswordInput('user_password1');
            if (!defined("ADMIN_PANEL")) {
                addNotice("success", $this->_completeMessage, 'all');
            } else {
                addNotice("success", $this->_completeMessage, 'all');
            }
            return TRUE;
        }
        return FALSE;
    }