As of version 3.9.12 it is possible to implement custom screening actions to replace / add to the default actions provided.
Here’s a code snippet demonstrating how this can be done:
class Matador_Custom_Screening_Example {
public function __construct() {
add_filter( 'matador_application_screen_control_options', [ __CLASS__,'add_buttons_to_ui' ], 10, 1 );
add_filter( 'matador_application_screen_allowed_actions', [ __CLASS__,'add_actions_to_permitted_params' ], 10, 1 );
add_action( 'matador_application_screen_custom_action', [ __CLASS__,'save_screened_submission_status_to_application_data' ], 10, 4 );
add_filter( 'matador_bullhorn_submit_candidate_to_job_body', [ __CLASS__,'set_submission_status' ], 10, 4 );
}
public static function add_buttons_to_ui( $options ) {
return [
'contact' => __( 'Need to Contact', 'textdomain' ),
'review' => __( 'Need to Review', 'textdomain' ),
'reject' => __( 'Reject', 'textdomain' ),
];
}
public static function add_actions_to_permitted_params( $actions ) {
return [
...$actions,
'contact',
'review',
'reject',
];
}
public static function save_screened_submission_status_to_application_data( $application_id, $action, $candidate_sync_status_key, $application_processing_preapproval_status_key ) {
// We always want the application to be marked for apply, so that a job submision will be created.
update_post_meta( $application_id, $candidate_sync_status_key, -1 );
update_post_meta( $application_id, $application_processing_preapproval_status_key, 'marked-for-apply' );
$application_data = get_post_meta( $application_id, '_application_data', true );
// Set a flag which will determine what status is set on the job submission when we sync this application.
// We're doing this in the application data, not the post meta, because we won't have the application wpid in the `matador_bullhorn_submit_candidate_to_job_body` filter.
$application_data['_screened_submission_status'] = match ( $action ) {
'contact' => 'Need to Contact',
'review' => 'Need to Review',
'reject' => 'Need to Reject',
default => 'Need to Review',
};
update_post_meta( $application_id, '_application_data', $application_data );
}
public static function set_submission_status( $body, $candidate, $job_id, $application ) {
$screened_submission_status = $application['_screened_submission_status'] ?? 'Need to Review';
if ( ! empty( $screened_submission_status ) ) {
$body['status'] = $screened_submission_status;
}
return $body;
}
}