function subscriptions_write in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_write()
- 7 subscriptions.module \subscriptions_write()
- 2.0.x subscriptions.module.old.php \subscriptions_write()
Helper function to do access checking and create a subscription.
Parameters
string $access_key: The key for checking access to the subscription item.
string $module: Module that implements the subscription.
string $field: Field that's being checked for the subscription.
mixed $value: Value that must be in the field in order to trigger the subscription.
int $author_uid: Optional ID of the author if the subscription is restricted to nodes by on specific author.
object|null $recipient: Optional user object of the recipient.
int $send_interval: Optional send interval, must be >0.
int $send_updates: Optional flag (0 or 1) to indicate whether to trigger on node updates.
int $send_comments: Optional flag (0 or 1) to indicate whether to trigger on comment additions or changes.
1 call to subscriptions_write()
- subscriptions_page_form_submit in ./
subscriptions.admin.inc - Subscriptions page submit handler.
File
- ./
subscriptions.module, line 292 - Subscriptions module.
Code
function subscriptions_write($access_key, $module, $field, $value, $author_uid = -1, $recipient = NULL, $send_interval = 1, $send_updates = 0, $send_comments = 0) {
global $user;
// Access checking
$recipient_uid = isset($recipient) ? $recipient : $user->uid;
$access = subscriptions_types('access', $access_key);
if ($recipient_uid && $access && ($recipient_uid == $user->uid && user_access($access) || user_access('administer user subscriptions')) || $recipient_uid == 0 && user_access('administer site configuration')) {
subscriptions_write_subscription($module, $field, $value, $author_uid, $recipient_uid, $send_interval, $send_updates, $send_comments);
}
}