You are here

function subscriptions_delete in Subscriptions 7

Same name and namespace in other branches
  1. 2.0.x subscriptions.module.old.php \subscriptions_delete()

Delete one or more subscriptions for a specific user.

Parameters

int $recipient_uid: The UID of the user whose subscription(s) to delete. If this is the only argument, all subscriptions of that user are deleted.

string|null $module: The module,...

string|null $field: the field, and

mixed|null $value: the value of the subscription(s) to delete.

int|null $author_uid: The UID of the content author for by-author subscriptions.

Return value

int|null|\DatabaseStatementInterface The number of deleted rows or a database connection-dependent value.

6 calls to subscriptions_delete()
subscriptions_delete_form_submit in ./subscriptions.module
Deletes Subscription form submit handler.
subscriptions_delete_for_all_users in ./subscriptions.module
Delete one or more subscriptions for all users.
subscriptions_og_og_membership_delete in contrib/subscriptions_og/subscriptions_og.module
Implements hook_og_membership_delete().
subscriptions_page_form_submit in ./subscriptions.admin.inc
Subscriptions page submit handler.
subscriptions_ui_node_form_submit in ./subscriptions_ui.module
Node subscriptions node subform submit handler.

... See full list

File

./subscriptions.module, line 418
Subscriptions module.

Code

function subscriptions_delete($recipient_uid, $module = NULL, $field = NULL, $value = NULL, $author_uid = NULL) {
  $query = db_delete('subscriptions');
  foreach (array(
    'module',
    'field',
    'value',
    'author_uid',
    'recipient_uid',
  ) as $column) {
    if (!empty(${$column})) {
      $query
        ->condition($column, ${$column});
    }
  }
  return $query
    ->execute();
}