You are here

function og_notifications_groups in Organic groups 6.2

Options callback for subscription fields in hook_notifications. Returns a list of groups for the current user (presuming that this callback is only relevant in the "add subscriptions" page).

Return value

Array $options An array of the users organic groups.

1 string reference to 'og_notifications_groups'
og_notifications_notifications in modules/og_notifications/og_notifications.module
Implementation of hook_notifications().

File

modules/og_notifications/og_notifications.module, line 402
Provide notifications and messaging support for organic groups.

Code

function og_notifications_groups() {
  $options = array();
  $uid = arg(0) == 'user' && is_numeric(arg(1)) ? arg(1) : 0;
  $result = db_query("SELECT n.nid, n.title FROM {og_uid} ogu INNER JOIN {node} n USING (nid) WHERE ogu.uid = %d", $uid);
  while ($group = db_fetch_object($result)) {
    $options[$group->nid] = $group->title;
  }
  return $options;
}