You are here

function subscriptions_get_subscription in Subscriptions 5.2

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

Get subscription sid for the given parameters.

1 call to subscriptions_get_subscription()
subscriptions_autosubscribe in ./subscriptions.module
Subscribe users to content they post, if not already subscribed (context: on_post, on_update, on_comment).

File

./subscriptions.module, line 270
Subscriptions module.

Code

function subscriptions_get_subscription($uid, $module, $field, $value, $author_uid = -1) {
  static $subscriptions;
  if (!isset($subscriptions[$uid][$module][$field][$value][$author_uid])) {
    $sql = "SELECT sid FROM {subscriptions} WHERE module = '%s' AND field = '%s' AND value = '%s' AND author_uid = %d AND recipient_uid = %d";
    $subscriptions[$uid][$module][$field][$value][$author_uid] = db_result(db_query($sql, $module, $field, $value, $author_uid, $uid));
  }
  return $subscriptions[$uid][$module][$field][$value][$author_uid];
}