function commons_notifications_group_unsubscribe in Drupal Commons 6.2
Menu callback to remove all subscriptions of a current user to the given group
Parameters
$group: The group object
1 string reference to 'commons_notifications_group_unsubscribe'
- commons_notifications_menu in modules/
features/ commons_notifications/ commons_notifications.module - Implementation of hook_menu()
File
- modules/
features/ commons_notifications/ commons_notifications.module, line 119
Code
function commons_notifications_group_unsubscribe($group) {
global $user;
// Build subscription query information for notifications
$params = array(
'type' => 'grouptype',
'uid' => $user->uid,
);
$conditions = array(
array(
'type' => 'group',
'value' => $group->nid,
),
);
// Remove the group subscriptions
notifications_delete_subscriptions($params, $conditions);
// Show a success message
drupal_set_message(t('Notifications for %group have been stopped', array(
'%group' => $group->title,
)));
// Redirect to the group homepage
drupal_goto("node/{$group->nid}");
}