You are here

function subscriptions_get in Subscriptions 2.0.x

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

Get subscriptions.

Parameters

array $params: Array of parameters for the query.

Return value

array Array of subscriptions indexed by uid, module, field, value, author_uid.

File

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

Code

function subscriptions_get(array $params) {
  $subscriptions = array();

  // Build query
  $query = db_select('subscriptions', 's');
  $query
    ->fields('s');
  foreach ($params as $field => $value) {
    $query
      ->condition($field, $value);
  }
  foreach ($query
    ->execute() as $s) {
    $subscriptions[$s->recipient_uid][$s->module][$s->field][$s->value][$s->author_uid] = 1;
  }
  return $subscriptions;
}