You are here

function og_get_subscriptions in Organic groups 5.3

Same name and namespace in other branches
  1. 5.8 og.module \og_get_subscriptions()
  2. 5 og.module \og_get_subscriptions()
  3. 5.2 og.module \og_get_subscriptions()
  4. 5.7 og.module \og_get_subscriptions()
  5. 6.2 og.module \og_get_subscriptions()
  6. 6 og.module \og_get_subscriptions()
7 calls to og_get_subscriptions()
og_access_alter_nongroup_form in ./og_access.module
og_access_node_grants in ./og_access.module
Implementation of hook_node_grants().
og_form_add_og_audience in ./og.module
Helper method to add OG audience fields to a given form. This is lives in a separate function from og_form_alter() so it can be shared by other OG contrib modules.
og_nodeapi in ./og.module
Implementation of hook_nodeapi().
og_unsubscribe in ./og.module

... See full list

File

./og.module, line 865

Code

function og_get_subscriptions($uid, $min_is_active = 1, $reset = FALSE) {
  static $subscriptions = array();
  if ($reset) {
    unset($subscriptions[$uid]);
  }
  if (!isset($subscriptions[$uid][$min_is_active])) {
    list($types, $in) = og_get_sql_args();
    array_unshift($types, $min_is_active);
    array_unshift($types, $uid);
    $sql = "SELECT n.title, n.type, n.status, ou.* FROM {og_uid} ou INNER JOIN {node} n ON ou.nid = n.nid WHERE ou.uid = %d AND ou.is_active >= %d AND n.type {$in} ORDER BY n.title";
    $result = db_query($sql, $types);
    while ($row = db_fetch_array($result)) {
      $subscriptions[$uid][$min_is_active][$row['nid']] = $row;
    }
    if (!isset($subscriptions[$uid][$min_is_active])) {
      $subscriptions[$uid][$min_is_active] = array();
    }
  }
  return $subscriptions[$uid][$min_is_active];
}