function subscriptions_write_subscription in Subscriptions 5.2
Same name and namespace in other branches
- 6 subscriptions.module \subscriptions_write_subscription()
- 7 subscriptions.module \subscriptions_write_subscription()
- 2.0.x subscriptions.module.old.php \subscriptions_write_subscription()
Create a subscription.
3 calls to subscriptions_write_subscription()
- subscriptions_add_form_submit in ./
subscriptions.admin.inc - Add Subscription form submit handler.
- subscriptions_autosubscribe in ./
subscriptions.module - Subscribe users to content they post, if not already subscribed (context: on_post, on_update, on_comment).
- subscriptions_write in ./
subscriptions.module - 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.module - Node subscriptions node subform submit handler.
File
- ./
subscriptions.module, line 292 - Subscriptions module.
Code
function subscriptions_write_subscription($module, $field, $value, $author_uid, $recipient_uid, $send_interval = 1, $send_updates = 0, $send_comments = 0) {
db_query("UPDATE {subscriptions} SET send_interval = %d, send_updates = %d, send_comments = %d WHERE module = '%s' AND field ='%s' AND value='%s' AND recipient_uid = %d AND author_uid = %d", $send_interval, $send_updates, $send_comments, $module, $field, $value, $recipient_uid, $author_uid);
if (!db_affected_rows()) {
@db_query("INSERT INTO {subscriptions} (module, field, value, author_uid, recipient_uid, send_interval, send_updates, send_comments) VALUES ('%s', '%s', '%s', %d, %d, %d, %d, %d)", $module, $field, $value, $author_uid, $recipient_uid, $send_interval, $send_updates, $send_comments);
}
}