function _og_menu_overview_page in Organic Groups Menu (OG Menu) 6
Same name and namespace in other branches
- 5 og_menu.admin.inc \_og_menu_overview_page()
Menu callback which shows an overview page of all of member's menus and their descriptions.
File
- ./
og_menu.admin.inc, line 6
Code
function _og_menu_overview_page() {
global $user;
$sql = '';
// list only group menus for which member has access...
if (!user_access('administer group menu')) {
$sql = db_query("\n SELECT distinct {og_uid}.nid, {og_menu_groups}.*, {menu_custom}.*\n FROM {og_uid} \n JOIN (\n {menu_custom},\n {og_menu_groups}\n ) \n ON (\n {menu_custom}.menu_name = {og_menu_groups}.mid \n AND \n {og_menu_groups}.gid = {og_uid}.nid\n )\n WHERE {og_uid}.uid = {$user->uid} \n ORDER BY {menu_custom}.title\n ;");
}
else {
// ...unless user is an administrator, then use this
$sql = db_query("\n SELECT distinct {og_uid}.nid, {og_menu_groups}.*, {menu_custom}.*\n FROM {og_uid} \n JOIN (\n {menu_custom},\n {og_menu_groups}\n ) \n ON (\n {menu_custom}.menu_name = {og_menu_groups}.mid \n AND \n {og_menu_groups}.gid = {og_uid}.nid\n )\n ORDER BY {menu_custom}.title;");
}
// generic message
$message = '<p>Below is a list of group menus you have privileges to administer. If you don\'t see any menus please contact a site administrator.</p>';
$content = array();
while ($menu = db_fetch_array($sql)) {
$menu['href'] = 'admin/build/menu-customize/' . $menu['menu_name'];
$menu['localized_options'] = array();
$content[] = $menu;
}
if (count($content) > 0) {
$content = theme('admin_block_content', $content);
return $message . $content;
}
else {
return $message;
}
}