function notifications_get_subscriptions in Notifications 6
Same name and namespace in other branches
- 5 notifications.module \notifications_get_subscriptions()
- 6.4 notifications.module \notifications_get_subscriptions()
- 6.2 notifications.module \notifications_get_subscriptions()
- 6.3 notifications.module \notifications_get_subscriptions()
- 7 notifications.module \notifications_get_subscriptions()
Get subscriptions that fit a set of conditions.
@todo Check field types for building the query
Parameters
$params: Array of parameters for the query
$conditions: Optional array of condition fields
$limit: Whether to limit the result to subscriptions with exactly that condition fields
$key: Optional key field to use as the array index. Will default to sid
$pager: Whether to throw a pager query
Return value
Array of subscriptions indexed by uid, module, field, value, author
7 calls to notifications_get_subscriptions()
- NotificationsBasicTests::testNotificationsBasicAPI in tests/
notifications_api.test - Play with creating, retrieving, deleting a pair subscriptions
- notifications_content_page_nodetype in notifications_content/
notifications_content.pages.inc - User subscriptions to content types
- notifications_custom_get_subscription in notifications_custom/
notifications_custom.module - Get user subscription for a custom one
- notifications_save_subscription in ./
notifications.module - Update or create subscription
- notifications_tags_user_form in notifications_tags/
notifications_tags.module - Returns the taxonomy subscription form
File
- ./
notifications.module, line 901 - Notifications module
Code
function notifications_get_subscriptions($params, $conditions = array(), $limit = TRUE, $key = 'sid', $pager = NULL) {
// Build query conditions using the query builder
$query = notifications_subscriptions_query_build($params, $conditions, $limit);
$query['select'][] = 'n.*';
list($sql, $args) = notifications_query_sql($query);
if ($pager) {
$sql .= ' ORDER BY n.sid';
$result = pager_query($sql, $pager, 0, NULL, $args);
}
else {
$result = db_query($sql, $args);
}
$subscriptions = array();
while ($subs = db_fetch_object($result)) {
$subscriptions[$subs->{$key}] = notifications_load_subscription($subs);
}
return $subscriptions;
}