Default WPRM Submit Function

class-wp-resume-manager-form-submit-resume.php

/**
 * Submit Step
 */
public static function submit() {
	global $job_manager, $post;

	self::init_fields();

	// Load data if neccessary
	if ( ! empty( $_POST['edit_resume'] ) && self::$resume_id ) {
		$resume = get_post( self::$resume_id );
		foreach ( self::$fields as $group_key => $fields ) {
			foreach ( $fields as $key => $field ) {
				switch ( $key ) {
					case 'candidate_name' :
						self::$fields[ $group_key ][ $key ]['value'] = $resume->post_title;
					break;
					case 'resume_content' :
						self::$fields[ $group_key ][ $key ]['value'] = $resume->post_content;
					break;
					case 'resume_skills' :
						self::$fields[ $group_key ][ $key ]['value'] = implode( ', ', wp_get_object_terms( $resume->ID, 'resume_skill', array( 'fields' => 'names' ) ) );
					break;
					case 'resume_category' :
						self::$fields[ $group_key ][ $key ]['value'] = wp_get_object_terms( $resume->ID, 'resume_category', array( 'fields' => 'ids' ) );
					break;
					default:
						self::$fields[ $group_key ][ $key ]['value'] = get_post_meta( $resume->ID, '_' . $key, true );
					break;
				}
			}
		}
		self::$fields = apply_filters( 'submit_resume_form_fields_get_resume_data', self::$fields, $resume );
	}

	get_job_manager_template( 'resume-submit.php', array(
		'class'              => __CLASS__,
		'form'               => self::$form_name,
		'resume_id'          => self::get_resume_id(),
		'job_id'             => self::get_job_id(),
		'action'             => self::get_action(),
		'resume_fields'      => self::get_fields( 'resume_fields' ),
		'submit_button_text' => __( 'Preview resume →', 'wp-job-manager-resumes' )
	), 'wp-job-manager-resumes', RESUME_MANAGER_PLUGIN_DIR . '/templates/' );
}
No comments yet.

Leave a Reply