You are here

function _og_notifications_user_grouptypes in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \_og_notifications_user_grouptypes()
  2. 5 og_notifications/og_notifications.module \_og_notifications_user_grouptypes()
  3. 5.7 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 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 700
Provide notifications and messaging support for organic 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;
}