Add custom input fields
add_action('job_bm_company_reviews_form', 'job_bm_company_reviews_form_custom_input');
function job_bm_company_reviews_form_custom_input($company_id){
?>
<div class="form-field-wrap">
<div class="field-title"><?php echo __('Custom input field','job-board-manager-company-profile'); ?></div>
<div class="field-input">
<input type="text" name="custom_input" value="">
<p class="field-details"><?php echo __('Custom input field description.','job-board-manager-company-profile'); ?>
</p>
</div>
</div>
<?php
}
validated data for custom input field
add_filter('job_bm_company_reviews_submit_errors','job_bm_company_reviews_submit_errors_custom',90,2);
function job_bm_company_reviews_submit_errors_custom($error, $post_data){
if(empty($post_data['custom_input'])){
$error->add( 'custom_input', __( 'ERROR: Custom input is empty.', 'job-board-manager-company-profile' ) );
}
return $error;
}
Save data
add_filter('job_bm_company_reviews_submitted','job_bm_company_reviews_submitted_custom',90,2);
function job_bm_company_reviews_submitted_custom( $comment_id, $post_data){
$custom_input = isset($post_data['custom_input']) ? sanitize_text_field($post_data['custom_input']) : '';
update_comment_meta($comment_id, 'custom_input', $custom_input);
}
