function _og_notifications_user_grouptypes in Organic groups 5
Same name and namespace in other branches
- 5.8 og_notifications/og_notifications.module \_og_notifications_user_grouptypes()
- 5.7 og_notifications/og_notifications.module \_og_notifications_user_grouptypes()
- 6 modules/og_notifications/og_notifications.module \_og_notifications_user_grouptypes()
Retrieve a list of organic group content types 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 $ngrouptypes An associative array of the resulting content types sorted by groups.
1 call to _og_notifications_user_grouptypes()
- og_notifications_user_page in 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
- og_notifications/
og_notifications.module, line 467 - Subscriptions to content in groups.
Code
function _og_notifications_user_grouptypes($uid) {
$query = "SELECT no.*, nof1.value AS group_nid, nof2.value AS node_type FROM {notifications} no\n INNER JOIN {notifications_fields} nof1 ON no.sid = nof1.sid\n INNER JOIN {notifications_fields} nof2 ON no.sid = nof2.sid\n WHERE no.uid = %d AND (no.type = 'grouptype') AND no.conditions = 2 AND nof1.field = 'group' AND nof2.field = 'type'\n ORDER BY group_nid, node_type";
$results = db_query($query, $uid);
$ngrouptypes = array();
while ($sub = db_fetch_object($results)) {
$ngrouptypes[$sub->group_nid][$sub->node_type] = $sub;
}
return $ngrouptypes;
}