function _og_notifications_user_groups in Organic groups 6
Same name and namespace in other branches
- 5.8 og_notifications/og_notifications.module \_og_notifications_user_groups()
- 5 og_notifications/og_notifications.module \_og_notifications_user_groups()
- 5.7 og_notifications/og_notifications.module \_og_notifications_user_groups()
Retrieve a list of organic groups that a user is subscribed (via notifications) to.
Parameters
Integer $uid: The user ID of the user whose groups are to be retrieved.
Return value
Array $ngroups An associative array of the resulting groups.
1 call to _og_notifications_user_groups()
- og_notifications_user_page in modules/
og_notifications/ og_notifications.module - Menu callback: Group and grouptype subscription management form. This should ideally play nicer with notifications_user_form. However, due to issues with support for multi-field subscriptions, it is currently going about things in a roundabout manner.
File
- modules/
og_notifications/ og_notifications.module, line 674 - Provide notifications and messaging support for organic groups.
Code
function _og_notifications_user_groups($uid) {
// No checks for group published or not? NB: Nodes belonging to unpublished
// groups are still accessible with links to the parent group.
$query = "SELECT no.*, nof.value AS nid, n.type AS node_type, n.title FROM {notifications} no\n INNER JOIN {notifications_fields} nof ON no.sid = nof.sid LEFT JOIN {node} n ON nof.value = CAST(n.nid AS CHAR(255))\n WHERE no.uid = %d AND (no.type = 'group') AND no.conditions = 1 AND nof.field = 'group'\n ORDER BY node_type, n.title";
$results = db_query($query, $uid);
$ngroups = array();
while ($sub = db_fetch_object($results)) {
$ngroups[$sub->nid] = $sub;
}
return $ngroups;
}