You are here

function subscriptions_og_og_membership_insert in Subscriptions 7

Same name and namespace in other branches
  1. 2.0.x subscriptions_og/subscriptions_og.module \subscriptions_og_og_membership_insert()

Implements hook_og_membership_insert().

File

contrib/subscriptions_og/subscriptions_og.module, line 247
Allow users to subscribe to content posted to an organic group.

Code

function subscriptions_og_og_membership_insert($og_membership) {
  $autosubscribe = variable_get('subscriptions_og_autosubscribe', FALSE);
  if ($autosubscribe && $og_membership->group_type == 'node' && $og_membership->entity_type == 'user') {
    $send_interval = _subscriptions_get_setting('send_interval', $og_membership->etid);
    $send_updates = _subscriptions_get_setting('send_updates', $og_membership->etid);
    $send_comments = _subscriptions_get_setting('send_comments', $og_membership->etid);
    subscriptions_write_subscription('node', 'group_audience', $og_membership->gid, -1, $og_membership->etid, $send_interval, $send_updates, $send_comments);
  }
}