As the title suggests, this addition will send an email when a new review is submitted. It negates the need to constantly check for new reviews. I like automation!!!!
Find this bit of code in reviews.php
if ($_POST["rating"] && ($_POST["rating"] == $_POST["confirm"])) {
$sql = "INSERT INTO `".$config_databaseTablePrefix."reviews` SET created='".time()."',approved='0', product_name='".database_safe($q)."', rating='".database_safe($_POST["rating"])."', comments='".database_safe(stripslashes(trim($_POST["comments"])))."'";
database_queryModify($sql,$insertId);
}
and change it to this...
if ($_POST["rating"] && ($_POST["rating"] == $_POST["confirm"])) {
$sql = "INSERT INTO `".$config_databaseTablePrefix."reviews` SET created='".time()."',approved='0', product_name='".database_safe($q)."', rating='".database_safe($_POST["rating"])."', comments='".database_safe(stripslashes(trim($_POST["comments"])))."'";
database_queryModify($sql,$insertId);
// Send admin email.
$to = 'info@example.com';
$subject = 'New review submitted on My Site';
$body = 'Moderate the review => 'http://url_to_your_admin/admin/';
$from = 'info@example.com';
$headers = "MIME-Version: 1.0" . "\n";
$headers .= "Content-type:text/html;charset=utf-8" . "\n";
$headers .= "From:" . $from . "\n";
mail ($to, $subject, $body, $headers);
}
Hey,
Not sure if i'll use this, i have it so that it's highlighted when i pop into the admin section, but it's a nice little mod that i'm sure others will appreciate :) Few more little mods like this we need on here.
Cheers