Email message code snippets cause an error when I try to implement them.
-
I can write C and JavaScript but never did any php. I wrote enough asp to be able to get by. I’m just beginning to get into it a little. My eye is not keen enough yet to spot an issue.
I’m trying to implement emails to go out to a new user who submitted a CV and also to an employer who just added a job listing.I am making slight customisations to the user journey and will want to change the messages accordingly.
I took the suggested code snippet without changes first and attempted adding it to functions.php via the jobscout theme customer page
Up to this everything has gone well and it is beginning to shape up.When I add this code and try to UPDATE. I get an error message,
I’ve tried all kinds, including commenting out sections and I cant see any obvious reason for the error.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');
Can anybody suggest what the problem might be?
- The topic ‘Email message code snippets cause an error when I try to implement them.’ is closed to new replies.