moderate && variable_get('modr8_send_moderated', FALSE)) { // Keep modr8_usermail-format to sent an e-mail when a node is updated or inserted and put into the moderation queue. modr8_adminmail_usermail('moderated', $node->nid, array('note' => '')); } break; } } /** * Changed copy of modr8_usermail(). */ function modr8_adminmail_usermail($op, $nid, $values) { $node = node_load($nid); if (is_object($node)) { switch ($op) { case 'moderated': $subject = variable_get('modr8_moderated_subject', '[%site] %title has been put into moderation'); $message = variable_get('modr8_moderated_text', modr8_moderated_default()); $optype = t('moderated'); break; } // get the user info for author $account = user_load(array('uid' => $node->uid)); $note = (!empty($values['note']) ? theme('modr8_note', $values['note']) : ''); $sendmail_to = variable_get('modr8_moderated_to', ''); if (!$sendmail_to) { $sendmail_to = variable_get('site_mail', ini_get('sendmail_from')); } if (empty($site_mail) && empty($sendmail_to)) { drupal_set_message(t('You should create an administrator mail address for your site! Do it here.', array('@url' => url('admin/settings/site-information'))), 'error'); } // send the email $params = array('account' => $account, 'node' => $node, 'subject' => $subject, 'message' => $message, 'note' => $note); if ($account->uid == 0) { $message = t('Anonymous user; no %type message was sent.', array('%type' => $optype)); } else { $sent = drupal_mail('modr8', 'notify', $sendmail_to, user_preferred_language($account), $params); if (!empty($sent['result'])) { watchdog('modr8', t('%type message was sent to %username', array('%type' => $optype, '%username' => $account->name))); $message = filter_xss(nl2br($sent['body']), array('br', 'a')); // Return sanitized e-mail with HTML breaks added. } else { $message = t('There was a problem sending the %type message to %username', array('%type' => $optype, '%username' => $account->name)); watchdog('modr8', $message); } } } else { $message = t('An error occurred when trying to load this content.'); watchdog('modr8', $message); // this probably won't ever get called } return $message; } function modr8_moderated_default() { return t( 'A %type entry entitled "%title" has been put into the moderator queue. You can visit %node_url to accept it. %note Regards, The %site team'); }