function _og_notification_check_message in Organic groups 6.2
Same name and namespace in other branches
- 5.3 og_notifications/og_notifications.module \_og_notification_check_message()
- 6 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
Integer The subscription ID if this is an OG notification message. 0, 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 553 - 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']);
// 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.
foreach ($params as $current_sid) {
$sid = db_result(db_query("SELECT sid FROM {notifications} WHERE type = 'grouptype' AND sid = %d", $current_sid));
if ($sid) {
break;
}
}
}
return $sid > 0 ? $sid : 0;
}