You are here

function subscriptions_write_subscription in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 5.2 subscriptions.module \subscriptions_write_subscription()
  2. 6 subscriptions.module \subscriptions_write_subscription()
  3. 7 subscriptions.module \subscriptions_write_subscription()

Create a subscription.

Parameters

string $module:

string $field:

mixed $value:

int $author_uid:

int $recipient_uid:

int $send_interval:

int $send_updates:

int $send_comments:

4 calls to subscriptions_write_subscription()
subscriptions_add_form_submit in ./subscriptions.admin.old.php
Add Subscription form submit handler.
subscriptions_autosubscribe in ./subscriptions.module.old.php
Subscribes users to content they post, if not already subscribed (context: on_post, on_update, on_comment).
subscriptions_og_og_membership_insert in subscriptions_og/subscriptions_og.module
Implements hook_og_membership_insert().
subscriptions_write in ./subscriptions.module.old.php
Helper function to do access checking and create a subscription.
1 string reference to 'subscriptions_write_subscription'
subscriptions_ui_node_form_submit in subscriptions_ui/subscriptions_ui.module
Node subscriptions node subform submit handler.

File

./subscriptions.module.old.php, line 632
Subscriptions module.

Code

function subscriptions_write_subscription($module, $field, $value, $author_uid, $recipient_uid, $send_interval = 1, $send_updates = 0, $send_comments = 0) {
  db_merge('subscriptions')
    ->key(array(
    'module' => $module,
    'field' => $field,
    'value' => $value,
    'recipient_uid' => $recipient_uid,
    'author_uid' => $author_uid,
  ))
    ->fields(array(
    'send_interval' => $send_interval,
    'send_updates' => $send_updates ? 1 : 0,
    'send_comments' => $send_comments ? 1 : 0,
  ))
    ->execute();
}