email notification
-
inside _submit.php
There is this block of code, I am looking for it to NOT email the admin of the post, but instead email the “contact_email” of the post. Using FireBug, the ID for the contact email is _lddlite_contact_email — I am not allowing users to create accounts and instead all new submissions are created under the admin, so the emails need to be redirected to the email they provided when they created the listing. Hope it makes sense.
Anyone have an idea how I can change this to email not the admin, but the email they listed in the post?
/**
* Send an email to a listing author when their listing has been updateding from pending review to published.
*
* @param object $post The WP_Post object
*/
function ldl_notify_when_approved($post) {// Don’t send an email if this is the wrong post type or it’s already been approved before
if (LDDLITE_POST_TYPE != get_post_type() || 1 == get_post_meta($post->ID, ‘_approved’, true))
return;$user = get_userdata($post->post_author);
$permalink = get_permalink($post->ID);
$title = get_the_title($post->ID);$to = $user->data->user_email;
$subject = ldl()->get_option(’email_onapprove_subject’);$message = ldl()->get_option(’email_onapprove_body’);
$message = str_replace(‘{site_title}’, get_bloginfo(‘name’), $message);
$message = str_replace(‘{directory_title}’, ldl()->get_option(‘directory_label’), $message);
$message = str_replace(‘{title}’, $title, $message);
$message = str_replace(‘{link}’, $permalink, $message);ldl_mail($to, $subject, $message);
update_post_meta($post->ID, ‘_approved’, 1);}
add_action(‘pending_to_publish’, ‘ldl_notify_when_approved’);
- The topic ‘email notification’ is closed to new replies.