You are here

function og_notifications_user_unsubscribe in Organic groups 6

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.3 og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  4. 5.7 og_notifications/og_notifications.module \og_notifications_user_unsubscribe()
  5. 6.2 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.

2 calls to og_notifications_user_unsubscribe()
og_notifications_og in modules/og_notifications/og_notifications.module
Implementation of hook_og().
og_notifications_user_subscribe in modules/og_notifications/og_notifications.module
Subscribe a user to a group or to be more precise, to all subscribe-able content types within the group. This method is also called during the upgrade process in .install.

File

modules/og_notifications/og_notifications.module, line 658
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,
  ));
}