Created
July 4, 2018 03:08
-
-
Save tripflex/bd42d1360e1e4f07003667e1423dcddb to your computer and use it in GitHub Desktop.
Only send email for anonymous users when using WP Job Manager Emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ^ There should ONLY be one of these at the top of child theme's functions.php file | |
add_filter( 'job_manager_emails_email_should_send', 'smyles_wpjm_emails_only_send_for_anon_users', 10, 4 ); | |
// You MUST configure the "template name" under the advanced settings area, and set it to "job_email_example_send_anon_only", | |
// or whatever custom email template name you decide to use. Each template must have a unique name | |
function smyles_wpjm_emails_only_send_for_anon_users( $should_send, $template, $listing_id, $that ) { | |
if ( $template && $template->template_name && $template->template_name === 'job_email_example_send_anon_only' ) { | |
if ( is_user_logged_in() ) { | |
return false; | |
} | |
} | |
return $should_send; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment