making author notification condtional
-
I use this piece of code to send notifications to the author of a post when it gets published. The problem is that everytime something changes, the e-mail is fired. I would like this code to be executed only the first time it gets published. Since I lack a serious amount of programming experience, i would be grateful to any kind of help
function authorNotification ($post_id) {
global $wpdb;
$post = get_post($post_id);
$author = get_userdata($post->post_author);
$message = “
Hallo “.$author->display_name.”,De door u geregistreerde winkel, “.$post->post_title.” is gepubliceerd op Scanjevoordeel.nl, u kunt nu uw aanbiedingen toevoegen.
Met vriendelijke groet,
Scanjevoordeel.nl”;
wp_mail($author->user_email, “Uw winkel op Scanjevoordeel.nl is gepubliceerd”, $message);}
add_action(‘publish_winkel’, ‘authorNotification’);Thanks
Luit
- The topic ‘making author notification condtional’ is closed to new replies.