You are here

function subscriptions_write in Subscriptions 5.2

Same name and namespace in other branches
  1. 6 subscriptions.module \subscriptions_write()
  2. 7 subscriptions.module \subscriptions_write()
  3. 2.0.x subscriptions.module.old.php \subscriptions_write()

Helper function to do access checking and create a subscription.

1 call to subscriptions_write()
subscriptions_page_form_submit in ./subscriptions.admin.inc
Subscriptions page submit handler.

File

./subscriptions.module, line 172
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);
  }
}