You are here

function reviews_notify_admin in Reviews 7

Send email to site wide email address when new review is left.

1 call to reviews_notify_admin()
reviews_add_review_submit in includes/reviews.pages.inc
Submit handler for reviews_add_review form.
1 string reference to 'reviews_notify_admin'
reviews_settings in includes/reviews.admin.inc
Form builder for the main settings page.

File

includes/reviews.pages.inc, line 307
This file contain all function necessary for displaying and leaving reviews.

Code

function reviews_notify_admin($nid) {
  global $base_url;
  $email = variable_get('site_mail', NULL);
  if (!is_null($email) && variable_get('reviews_notify_admin', 0) == 1) {
    $node = node_load($nid);
    $body = "A new review has been left for on node '{$node->title}'\r\n\r\n";
    $body .= "Click here to view: {$base_url}/admin/content/reviews/moderate";
    $hdrs = 'MIME-Version: 1.0' . "\r\n";
    $hdrs .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";
    $hdrs .= "From: Site Admin <{$email}>\r\n";
    mail($email, t('New Content Review'), $body, $hdrs);
  }
}