You are here

function og_notifications_user_subscribe in Organic groups 5

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

Subscribe a user to a 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_subscribe()
og_notifications_user_autosubscribe in og_notifications/og_notifications.module
Handle autosubscriptions for users when they join a group.

File

og_notifications/og_notifications.module, line 406
Subscriptions to content in groups.

Code

function og_notifications_user_subscribe($account, $gid) {
  $subscription = _notifications_subscription_defaults($account);
  $subscription['uid'] = $account->uid;
  $subscription['type'] = 'group';
  $subscription['event_type'] = 'node';
  $subscription['fields'] = array(
    'group' => $gid,
  );
  notifications_save_subscription($subscription);
}