Back to V3Tweaks
Question Asked
How can I get V3 to send out an email to the owner of a video when a comment has been made on their video
Original Forum Post
Solution
You will need to edit 1 file. So get your text editor ready. As always we recommend a php editor like
EditPlus
STEP 1
Download the following files from your FTP and save them anywhere on your computer
STEP 2
Edit
comments.php
Find the section with the following code
$sql = "INSERT into videocomments (by_id, by_username, video_id, comments, todays_date) VALUES
($user_id, '$user_name', $vid, '$comments', NOW())";
mysql_query($sql);
Replace the above code with the following code
$sql = "INSERT into videocomments (by_id, by_username, video_id, comments, todays_date) VALUES
($user_id, '$user_name', $vid, '$comments', NOW())";
mysql_query($sql);
//--------------------------V3 Tweek - Send email notification on comments--------------------------------
$sql1 = "SELECT * FROM videos WHERE indexer = $vid";
$result1 = mysql_query($sql1);
$results = mysql_fetch_array($result1);
$owner = $results['user_id'];
$sql = "SELECT email_address FROM member_profile WHERE user_id = $owner";
$result = @mysql_query($sql);
$results = mysql_fetch_array($result);
$owners_email = $results['email_address'];
$comment = strip_tags(html_entity_decode($postedValue[0]));
$video_url = $config["site_base_url"].'/videos/'.$vid.'/';
$from = $config["from_system_name"];
$from_email = $config["notifications_from_email"];
//Email details [you can change these 2 items]
$subject = 'You have a new video comment';
$message = "$video_url\n\n\n--------------------------------------------------------\n\n$comment";
@mail($owners_email,$subject,$message,"From: $from <$from_email>");
//----------------------------------------------------------------------------------------------------------
STEP 3
Upload all the files you edited back into their respective places in your FTP.
Thats its, now every time a comment is posted, the owner of the video will now get an email notification