芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/fluentformpro/src/Integrations/UserRegistration/Getter.php
id; } return wpFluent()->table('fluentform_form_meta') ->where('form_id', $formId) ->where('meta_key', 'user_registration_feeds') ->get(); } public function validate($settings, $settingsFields) { foreach ($settingsFields['fields'] as $field) { if ($field['key'] != 'CustomFields') continue; $errors = []; foreach ($field['primary_fileds'] as $primaryField) { if (!empty($primaryField['required'])) { if (empty($settings[$primaryField['key']])) { $errors[$primaryField['key']] = $primaryField['label'] . ' is required.'; } } } if ($errors) { wp_send_json_error([ 'message' => array_shift($errors), 'errors' => $errors ], 422); } } return $settings; } protected function updateUser($parsedData, $userId, $feed = []) { $firstName = trim(Arr::get($parsedData, 'first_name', '')); $lastName = trim(Arr::get($parsedData, 'last_name', '')); $name = $firstName; if ($lastName) { $name .= ' ' . $lastName; } $data = array_filter([ 'ID' => $userId, 'user_nicename' => Arr::get($parsedData, 'username'), 'display_name' => trim($name), 'user_url' => Arr::get($parsedData, 'user_url'), 'first_name' => $firstName, 'last_name' => $lastName, 'nickname' => $this->filteredNickname(Arr::get($parsedData, 'nickname', ''), $parsedData), 'description' => Arr::get($parsedData, 'description'), ]); $listId = Arr::get($feed, 'settings.list_id'); if ($listId === 'user_update') { $data = array_merge($data, array_filter([ 'user_pass' => Arr::get($parsedData, 'password'), 'user_email' => Arr::get($parsedData, 'email') ])); } if ($data) { return wp_update_user($data); } return new \WP_Error(301, 'Update Failed: Invalid Data'); } protected function addLog($title, $status, $description, $formId, $entryId, $integrationKey) { $logData = [ 'title' => $title, 'status' => $status, 'description' => $description, 'parent_source_id' => $formId, 'source_id' => $entryId, 'component' => $integrationKey, 'source_type' => 'submission_item' ]; do_action('fluentform/log_data', $logData); return true; } protected function filteredNickname($nickname, $parseDate) { if (defined('BP_VERSION')){ $nickname = trim($nickname); if (!$nickname) { $nickname = Arr::get($parseDate, 'username', ''); } $nickname = preg_replace("/\\s/", '-', trim($nickname)); return sanitize_user($nickname, true); } return $nickname; } protected function updatePluginsMetas($formData, $userId, $feed, $form) { // Maybe update Acf metas AcfHelper::maybeUpdateUserMetas($userId, $formData, $form, $feed); // Maybe update Jet Engine metas JetEngineHelper::maybeUpdateUserMetas($userId, $formData, $form, $feed); } }