function subscriptions_autosubscribe in Subscriptions 7
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_autosubscribe()
- 5 subscriptions.module \subscriptions_autosubscribe()
- 6 subscriptions.module \subscriptions_autosubscribe()
- 2.0.x subscriptions.module.old.php \subscriptions_autosubscribe()
Subscribes users to content they post, if not already subscribed (context: on_post, on_update, on_comment).
Parameters
string $module:
string $field:
int|string $value:
string $context:
1 call to subscriptions_autosubscribe()
- _subscriptions_content_autosubscribe in ./
subscriptions_content.module - Auto-subscribes the user, if the content type is not blocked.
File
- ./
subscriptions.module, line 709 - 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);
}
}