Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/7cb438859687990d759e to your computer and use it in GitHub Desktop.
Save tripflex/7cb438859687990d759e to your computer and use it in GitHub Desktop.
Default WPRM Submit Function
/**
* 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/' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment