Strong communication is definitely an important part of any business or website. So it makes sense that you’d want to email your employers / job listing submitters when their listings are finally approved!
To do so, simply add the following code to a plugin like Code Snippets:
function listing_published_send_email($post_id) {
if( 'job_listing' != get_post_type( $post_id ) ) {
return;
}
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your listing, ".$post->post_title." has just been approved at ".get_permalink( $post_id ).". Well done!
";
wp_mail($author->user_email, "Your job listing is online", $message);
}
add_action('pending_to_publish', 'listing_published_send_email');
add_action('pending_payment_to_publish', 'listing_published_send_email');
You can customize those messages quite easily, so be creative with it!
Send an email to the candidate when their resume is approved
If you’re using the Resume Manager add-on, you can also have an email sent to the candidate when their resume is approved. The code is similar to the above, just with some minor changes:
function resume_published_send_email($post_id) {
if( 'resume' != get_post_type( $post_id ) ) {
return;
}
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = "
Hi ".$author->display_name.",
Your resume, ".$post->post_title." has just been approved at ".get_permalink( $post_id ).". Well done!
";
wp_mail($author->user_email, "Your resume is online", $message);
}
add_action('pending_to_publish', 'resume_published_send_email');
add_action('pending_payment_to_publish', 'resume_published_send_email');