• Resolved davidrevo

    (@davidrevo)


    Hi Mike,

    I’ve just started to use your resume manager plugin these days. In my scenario, I’m gonna make the resume process as job apply process. Then, I need to do some customizations. Following your doc in github, I successfully added those new fields I wanted. However, everytime I submitted or updated these fields, they are actually not saved to the database.

    To get the reason, I went to “class-wp-resume-manager-form-submit-resume.php” file, and found the code below:

    /**
    	 * 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'] = current( wp_get_object_terms( $resume->ID, 'resume_category', array( 'fields' => 'slugs' ) ) );
    						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, $job );
    		}
    
    		get_job_manager_template( 'resume-submit.php', array(
    			'class'              => __CLASS__,
    			'form'               => self::$form_name,
    			'resume_id'          => self::get_resume_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/' );
    	}

    My question is how to save those fields using a filter. I need to save the job listing id or title in db so that the recruiter could check the candidate info as well as the job detail in their portal.

    Thanks for your assistance again, Mike

    https://www.ads-software.com/plugins/wp-job-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter davidrevo

    (@davidrevo)

    Following the wiki for job manager, I added the code below. But it still didn’t pre popup the existing data when I’m doing the update.

    // Add your own function to filter the fields
    add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );
    
    // This is your function which takes the fields, modifies them, and returns them
    function custom_submit_resume_form_fields( $fields ) {
    
        // Candidate Name
        $fields['resume_fields']['candidate_name']['label'] = "Candidate name";
    
        // Email Address
        $fields['resume_fields']['candidate_email']['label'] = "Email address";
    
        // Candidate Location
        $fields['resume_fields']['candidate_location']['placeholder'] = 'e.g. "Chadstone, VIC", "Sydney"';
    
        // Add new fields to store the job info of job application
        $fields['resume_fields']['job_listing_ID'] = array(
            'label'       => __( 'Job Listing ID', 'job_manager' ),
            'type'        => 'text',
            'required'    => true,
            'placeholder' => 'The job listing ID e.g. 1023',
            'priority'    => 13
            );
    
        // And return the modified fields
        return $fields;
    }
    
    add_action( 'resume_manager_update_resume_data', 'frontend_add_job_title_field_save', 10, 2 );
    
    function frontend_add_job_title_field_save( $resume_id, $values ) {
        update_post_meta( $resume_id, '_job_apply_job_id', $values['resume_fields']['job_listing_ID'] );
    }
    Thread Starter davidrevo

    (@davidrevo)

    Just checked the database, I think the data is already saved as postmeta, but the custom field is not hooked up when initializing fields.

    Plugin Author Mike Jolley

    (@mikejolley)

    Have you tried naming the meta and the field the same? I.e. instead of job_listing_ID use job_apply_job_id

    Thread Starter davidrevo

    (@davidrevo)

    Thanks, Mike. Problem solved.

    meta name = _ + field name;

    Thread Starter davidrevo

    (@davidrevo)

    : )

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding and updating new fields on resume-submit page’ is closed to new replies.