I've been struggling; can anyone help please?
I need the Wordpress Templatic Video theme to send a copy of the email that is sent to users when they upload a new video, to admin as well. Then admin will know to login and publish the video.
The theme should do this, but it doesn't. So, I'm having a go
The theme URL is: http://www.wordpressdirectorytemplates.com/motaz/video
The function that sends an email when users upload a video is:
/* send email of video post & update submit*/
global $post;
$post = get_post($last_postid);
$author = $post->post_author;
$name = get_the_author_meta( 'display_name', $author );
$email = get_the_author_meta( 'user_email', $author );
$title = $post->post_title;
$to[] = sprintf( '%s <%s>', $name, $email );
$subject = sprintf( 'Video Post: %s', $title );
$message = '';
$message .= "<p>Dear $name</p>";
if(isset($_REQUEST['pid']) && $_REQUEST['pid']!="")
{
$message .= '<p class="sucess_msg_prop">'. __('Thank you for submitting your video at our site, your request has been updated successfully.','templatic').'</p>';
}else{
/* if user set by default status publish than show different message */
$theme_settings = get_option('video_theme_settings');
if(isset($theme_settings['video_default_status']) && $theme_settings['video_default_status'] == 'publish'){
$message .= '<p class="sucess_msg_prop">'.__('The video will goes live on the site.','templatic').'</p>';
}else{
$message .= '<p class="sucess_msg_prop">'.__('The video will require admin approval before it goes live on the site.','templatic').'</p>';
$message .= '<p class="sucess_msg_prop">'.__('You will get an email confirmation once your video has been published.','templatic').'</p>';
}
}
$message .= "<p>You can view your video on the following link</p>";
$message .= '<a href="'.get_permalink($last_postid).'">'.get_permalink($last_postid).'</a>';
$message .= "<p>Thank you</p>";
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=UTF-8' . "
";
$fromEmail = get_option('admin_email');
$fromEmailName = stripslashes(get_option('blogname'));
wp_mail( $to, $subject, $message, $headers );
wp_redirect(site_url().'/?page=success&pid='.$last_postid);
exit;
}
}
I can get the email to go to admin instead of the user by adding:
$multiple_recipients = array(
'info@example.com');
And, then putting $multiple_recipients at the start of:
wp_mail($multiple_recipients , $to, $subject, $message, $headers );
But, this is plain wrong. Admin does get an email, but the user doesn't get theirs.
I also tried adding a function to the child theme functions file using the WP Codex for help; but, this is incorrect too:
function email_friends( $post_ID ) {
$friends = 'info@example.com';
wp_mail( $friends, "New Video Uploaded", 'A new video has been uploaded on http://nuntim.com');
return $post_ID;
}
add_action( 'function video_posts_submition_success_msg_fn', 'email_friends' );
Can anyone point me in the right direction?