How to add extra fields to register form for employer and candidate profile
Sometimes we need to add more fields to the registration form for employers or candidates. This is step by step for how to add more fields to the registration form via child theme.
If you just want to add field to employer profile, you can start from step 3
Step 1: Add field to register template file: /injob-child/iwj/register.php and /injob-child/iwj/register-popup.php

Step 2: Process data for new field via action iwj_register_process on functions.php
add_action('iwj_register_process', function($uid) {
$user = IWJ_User::get_user($uid);
//Process for employer field
if ($user->is_employer() && isset($_POST['employer_custom_field']) && sanitize_text_field($_POST['employer_custom_field'])) {
$employer = $user->get_employer();
update_post_meta($employer->get_id(), 'employer_custom_field', sanitize_text_field($_POST['employer_custom_field']));
}
//Process for candidate
if ($user->is_canđiate() && isset($_POST['candidate_custom_field']) && sanitize_text_field($_POST['candidate_custom_field'])) {
$candidate= $user->get_candidate();
update_post_meta($candidate->get_id(), 'candidate_custom_field', sanitize_text_field($_POST['candidate_custom_field']));
}
}
Step 3: Add new extra field to employer profile on fileinjob-child\iwj\dashboard\profile\employer-form.php
iwj_field_text('employer_custom_field', __('New custom field *', 'iwjob'), true, $post_id, null, '', '', __('Enter the value', 'iwjob'));
Step 4: Process for save employer custom field on profile update function.
add_action('employer_update_profile', function($emp) {
$custom_field = sanitize_text_field($_POST['employer_custom_field']);
update_post_meta($emp->get_id(), 'employer_custom_field', $custom_field );
});
Step 5: Add new extra field to employer profile in backend via filter iwj_employer_admin_fields on file functions.php
add_filter('iwj_employer_admin_fields', function($fields) {
$fields['general']['fields'][] = array(
'name' => __('New custom field', 'injob'),
'id' => 'employer_custom_field',
'type' => 'text',
'required' => true,
);
return $fields;
}
Step 6: Process for admin save employer.
add_action('iwj_admin_save_employer', function($pid) {
$custom_field = sanitize_text_field($_POST['employer_custom_field']);
update_post_meta($pid, 'employer_custom_field', $custom_field );
});
For candidates, you can follow employer steps, just change employer to candidate.