You are here

function _role_watchdog_notification in Role Watchdog 7

Same name and namespace in other branches
  1. 5 role_watchdog.module \_role_watchdog_notification()
  2. 6.2 role_watchdog.module \_role_watchdog_notification()
  3. 6 role_watchdog.module \_role_watchdog_notification()
  4. 7.2 role_watchdog.module \_role_watchdog_notification()

Internal function

Handles notification of changes in selected roles.

4 calls to _role_watchdog_notification()
_og_role_watchdog_add_role in modules/og_role_watchdog/og_role_watchdog.module
_og_role_watchdog_remove_role in modules/og_role_watchdog/og_role_watchdog.module
_role_watchdog_add_role in ./role_watchdog.module
Internal function
_role_watchdog_remove_role in ./role_watchdog.module
Internal function

File

./role_watchdog.module, line 306
Logs changes to user roles.

Code

function _role_watchdog_notification($rid, $vars = array()) {
  $monitor_roles = variable_get('role_watchdog_monitor_roles', NULL);
  if (in_array($rid, (array) $monitor_roles)) {
    foreach (_role_watchdog_get_notification_list() as $recipient) {
      if (drupal_mail('role_watchdog', 'notification', $recipient, language_default(), $vars)) {
        watchdog('role_watchdog', 'Sent notification to %recipient', array(
          '%recipient' => $recipient,
        ), WATCHDOG_INFO);
      }
      else {
        watchdog('role_watchdog', 'Unable to send notification to %recipient', array(
          '%recipient' => $recipient,
        ), WATCHDOG_ERROR);
      }
    }
  }
}