You are here

function subscriptions_autosubscribe in Subscriptions 6

Same name and namespace in other branches
  1. 5.2 subscriptions.module \subscriptions_autosubscribe()
  2. 5 subscriptions.module \subscriptions_autosubscribe()
  3. 7 subscriptions.module \subscriptions_autosubscribe()
  4. 2.0.x subscriptions.module.old.php \subscriptions_autosubscribe()

Subscribe users to content they post, if not already subscribed (context: on_post, on_update, on_comment).

1 call to subscriptions_autosubscribe()
_subscriptions_content_autosubscribe in ./subscriptions_content.module
Auto-subscribe, if the content type is not blocked.

File

./subscriptions.module, line 468
Subscriptions module.

Code

function subscriptions_autosubscribe($module, $field, $value, $context) {
  global $user;

  // if user has auto subscribe enabled and he's not already subscribed
  if ($user->uid && _subscriptions_get_setting('autosub_' . $context, $user) && !subscriptions_get_subscription($user->uid, $module, $field, $value)) {
    subscriptions_write_subscription($module, $field, $value, -1, $user->uid, _subscriptions_get_setting('send_interval', $user), 1, 1);
  }
}