/** * Submit Step is posted */ public function submit_handler() { try { // Init fields $this->init_fields(); // Get posted values $values = $this->get_posted_fields(); if (empty($_POST['submit_job'])) { return; } // Validate required if (is_wp_error($return = $this->validate_fields($values))) { throw new Exception($return->get_error_message()); } // Account creation if (!is_user_logged_in()) { $create_account = false; if (job_manager_enable_registration()) { if (job_manager_user_requires_account()) { if (!job_manager_generate_username_from_email() && empty($_POST['create_account_username'])) { throw new Exception(__('Please enter a username.', 'wp-job-manager')); } if (empty($_POST['create_account_email'])) { throw new Exception(__('Please enter your email address.', 'wp-job-manager')); } } if (!empty($_POST['create_account_email'])) { $create_account = wp_job_manager_create_account(array('username' => empty($_POST['create_account_username']) ? '' : $_POST['create_account_username'], 'email' => $_POST['create_account_email'], 'role' => get_option('job_manager_registration_role'))); } } if (is_wp_error($create_account)) { throw new Exception($create_account->get_error_message()); } } if (job_manager_user_requires_account() && !is_user_logged_in()) { throw new Exception(__('You must be signed in to post a new listing.')); } // Update the job $this->save_job($values['job']['job_title'], $values['job']['job_description'], $this->job_id ? '' : 'preview', $values); $this->update_job_data($values); // Successful, show next step $this->step++; } catch (Exception $e) { $this->add_error($e->getMessage()); return; } }
<a class="button" href="<?php echo apply_filters('submit_job_form_logout_url', wp_logout_url(get_permalink())); ?> "><?php _e('Sign out', 'wp-job-manager'); ?> </a> </div> </fieldset> <?php } else { $account_required = job_manager_user_requires_account(); $registration_enabled = job_manager_enable_registration(); $generate_username_from_email = job_manager_generate_username_from_email(); $login_url = listable_get_login_url(); $classes = listable_get_login_link_class('button'); ?> <fieldset> <label><?php _e('Have an account?', 'wp-job-manager'); ?> </label> <div class="field account-sign-in <?php echo listable_using_lwa() ? 'lwa' : ''; ?> "> <a class="<?php echo $classes; ?>