You are here

function _og_notification_check_message in Organic groups 6

Same name and namespace in other branches
  1. 5.3 og_notifications/og_notifications.module \_og_notification_check_message()
  2. 6.2 modules/og_notifications/og_notifications.module \_og_notification_check_message()

Helper function for og_notifications_message_alter. This function checks to see if the message object being passed is an OG notification.

Parameters

Object $message: The message object

Return value

Boolean True if this is an OG notification message. False, otherwise ...

1 call to _og_notification_check_message()
og_notifications_message_alter in modules/og_notifications/og_notifications.module
A workaround to ensure that OG can provide custom message templates for notifications.

File

modules/og_notifications/og_notifications.module, line 772
Provide notifications and messaging support for organic groups.

Code

function _og_notification_check_message($message) {
  $sid = 0;
  if (isset($message->notifications) && isset($message->notifications['subscriptions'])) {
    $params = current($message->notifications['subscriptions']);
    if (count($params) > 1) {

      // Check if "group" is one of the fields. This is a general presumption
      // that any subscription with at least two fields, one of them being a
      // group, is an OG subscription.
      $sid = db_result(db_query("SELECT sid FROM {notifications_fields} WHERE field = 'group' AND sid IN (" . db_placeholders($params) . ")", $params));
    }
  }
  return $sid > 0;
}