You are here

function og_menu_get_menus in Organic Groups Menu (OG Menu) 6

Same name and namespace in other branches
  1. 7.3 og_menu.module \og_menu_get_menus()

Returns acessible menus for a given user or gids in a structured array.

Parameters

gids: An optional array of group gids.

user: An optional array of the user object.

Return value

A structured array with menus list.

6 calls to og_menu_get_menus()
og_menu_block in ./og_menu.module
Implementation of hook_block().
og_menu_edit_item_form in ./og_menu.module
Menu callback; Build the menu link editing form.
og_menu_form_alter in ./og_menu.module
Implementation of hook_form_alter().
og_menu_nodeapi in ./og_menu.module
Implementation of hook_nodeapi().
og_menu_node_form_validate in ./og_menu.module

... See full list

File

./og_menu.module, line 484
Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.

Code

function og_menu_get_menus($gids = NULL, $user = NULL) {
  if (!$user) {
    global $user;
  }
  if (!$gids) {
    $gids = array_keys($user->og_groups);
  }
  $menus = array();
  $result = db_query("SELECT * FROM {menu_custom} m INNER JOIN {og_menu} om ON m.menu_name = om.menu_name WHERE om.gid IN (" . db_placeholders($gids, "int") . ") ORDER BY m.title", $gids);
  while ($menu = db_fetch_array($result)) {
    $menus[] = $menu;
  }
  return $menus;
}