/** * 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_resume']) || !wp_verify_nonce($_POST['_wpnonce'], 'submit_form_posted')) { 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 (resume_manager_enable_registration()) { if (resume_manager_user_requires_account()) { if (!resume_manager_generate_username_from_email() && empty($_POST['create_account_username'])) { throw new Exception(__('Please enter a username.', 'wp-job-manager-resumes')); } if (empty($_POST['candidate_email'])) { throw new Exception(__('Please enter your email address.', 'wp-job-manager-resumes')); } } if (!empty($_POST['candidate_email'])) { if (version_compare(JOB_MANAGER_VERSION, '1.20.0', '<')) { $create_account = wp_job_manager_create_account($_POST['candidate_email'], get_option('resume_manager_registration_role', 'candidate')); } else { $create_account = wp_job_manager_create_account(array('username' => empty($_POST['create_account_username']) ? '' : $_POST['create_account_username'], 'email' => $_POST['candidate_email'], 'role' => get_option('resume_manager_registration_role', 'candidate'))); } } } if (is_wp_error($create_account)) { throw new Exception($create_account->get_error_message()); } } if (resume_manager_user_requires_account() && !is_user_logged_in()) { throw new Exception(__('You must be signed in to post your resume.', 'wp-job-manager-resumes')); } // Update the job $this->save_resume($values['resume_fields']['candidate_name'], $values['resume_fields']['resume_content'], $this->resume_id ? '' : 'preview', $values); $this->update_resume_data($values); // Successful, show next step $this->step++; } catch (Exception $e) { $this->add_error($e->getMessage()); return; } }
/** * 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; } }
/** * Submit Step is posted */ public static function submit_handler() { try { // Init fields self::init_fields(); // Get posted values $values = self::get_posted_fields(); if (empty($_POST['submit_job']) || !wp_verify_nonce($_POST['_wpnonce'], 'submit_form_posted')) { return; } // Validate required if (is_wp_error($return = self::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() && !empty($_POST['create_account_email'])) { $create_account = wp_job_manager_create_account($_POST['create_account_email'], 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 job listing.')); } // Update the job self::save_job($values['job']['job_title'], $values['job']['job_description'], self::$job_id ? '' : 'preview', $values); self::update_job_data($values); // Successful, show next step self::$step++; } catch (Exception $e) { self::add_error($e->getMessage()); return; } }