Skip to content

Instantly share code, notes, and snippets.

@jom
Last active Dec 30, 2020
Embed
What would you like to do?
Remove Resume Preview Step
<?php
/**
* Remove the preview step when submitting resumes. Code goes in theme functions.php or custom plugin.
* @param array $steps
* @return array
*/
add_filter( 'submit_resume_steps', function( $steps ) {
unset( $steps['preview'] );
return $steps;
} );
/**
* Change button text.
*/
add_filter( 'submit_resume_form_submit_button_text', function() {
return __( 'Submit Resume', 'wp-job-manager-resumes' );
} );
/**
* Since we removed the preview step and it's handler, we need to manually publish resumes.
* @param int $resume_id
*/
add_action( 'resume_manager_update_resume_data', function( $resume_id ) {
$resume = get_post( $resume_id );
if ( in_array( $resume->post_status, array( 'preview', 'expired' ), true ) ) {
// Reset expirey.
delete_post_meta( $resume->ID, '_resume_expires' );
// Update resume listing.
$update_resume = array();
$update_resume['ID'] = $resume->ID;
$update_resume['post_status'] = get_option( 'resume_manager_submission_requires_approval' ) ? 'pending' : 'publish';
$update_resume['post_date'] = current_time( 'mysql' );
$update_resume['post_date_gmt'] = current_time( 'mysql', 1 );
wp_update_post( $update_resume );
}
} );
@electricbrick

This comment has been minimized.

Copy link

@electricbrick electricbrick commented Dec 30, 2020

@jom this snippet works fairly well, but seems to create a scenario where the preview step is replaced by a 'cover letter' step. When a user presses the "Submit" button on the cover letter step, they're redirected back to the original resume submission screen for the job they're applying to.

@jom

This comment has been minimized.

Copy link
Owner Author

@jom jom commented Dec 30, 2020

@electricbrick I don't think Resume Manager core has a "cover letter" step, per se, although its standard submission form does have a cover letter field. Are you using third party WPJM plugins or does your theme attempt to add special WPJM functionality?

I also haven't tested this snippet for a while and we have made some changes to the submission form process, so it might be broken.

@electricbrick

This comment has been minimized.

Copy link

@electricbrick electricbrick commented Dec 30, 2020

@jom you are correct in that it's a couple of fields under an form object with the class "apply_with_resume"; it only appears for a logged-in user, though.

On this particular site, we're not requiring account creation. So when a non-logged-in user completes the application, those users actually get redirected back to the resume submission page without seeing the submissions message fields. It's not until attempting subsequent submissions that non-logged-in users can see the submission message fields. (I'm assuming based on session cookies) However, those non-logged-in users aren't allowed to resubmit. I suspect this is a bit of an edge case, especially in terms of the site I'm working with. It is a little confusing, though, and I'm concerned that this will cause problems in the however-unlikely event my client posts multiple positions that a single applicant would be interested in.

Ultimately, regardless of the above circumstances I'd like to see the option of directing resume ubmitters to an entirely different "Thank You" page after they've completed the application process, so we could tie those visits to goal conversions in Google Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment