function subscriptions_get_subscription in Subscriptions 7
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_get_subscription()
- 6 subscriptions.module \subscriptions_get_subscription()
- 2.0.x subscriptions.module.old.php \subscriptions_get_subscription()
Gets subscription sid for the given parameters.
Parameters
int $uid:
string $module:
string $field:
mixed $value:
int $author_uid:
Return value
int
1 call to subscriptions_get_subscription()
- subscriptions_autosubscribe in ./
subscriptions.module - Subscribes users to content they post, if not already subscribed (context: on_post, on_update, on_comment).
File
- ./
subscriptions.module, line 604 - 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])) {
$subscriptions[$uid][$module][$field][$value][$author_uid] = db_query("SELECT sid FROM {subscriptions} WHERE module = :module AND field = :field AND value = :value AND author_uid = :author_uid AND recipient_uid = :recipient_uid", array(
':module' => $module,
':field' => $field,
':value' => $value,
':author_uid' => $author_uid,
':recipient_uid' => $uid,
))
->fetchField();
}
return $subscriptions[$uid][$module][$field][$value][$author_uid];
}