You are here

function og_notifications_user_unsubscribe in Organic groups 5.3

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  2. 5 og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  3. 5.7 og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  4. 6.2 modules/og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  5. 6 modules/og_notifications/og_notifications.module \og_notifications_user_unsubscribe()

Unsubscribe a user from a group. This also unsubscribes the user from any grouptype subscriptions within the group.

Parameters

Object $account: The user account object.

Integer $gid: The node ID of the group being subscribed to.

1 call to og_notifications_user_unsubscribe()
og_notifications_og in og_notifications/og_notifications.module
Implementation of hook_og().

File

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

Code

function og_notifications_user_unsubscribe($account, $gid) {

  // @todo: Handle direct node subscriptions for private groups.
  // Niche cases include multi-group nodes.
  notifications_delete_subscriptions(array(
    'uid' => $account->uid,
    'type' => 'grouptype',
  ), array(
    'group' => $gid,
  ));
  notifications_delete_subscriptions(array(
    'uid' => $account->uid,
    'type' => 'group',
  ), array(
    'group' => $gid,
  ));
}