function og_menu_create_menus in Organic Groups Menu (OG Menu) 5
1 call to og_menu_create_menus()
File
- ./
og_menu.module, line 337 - Modifies the menu module to support menus specific to organic groups.
Code
function og_menu_create_menus() {
$groups = og_menu_generate_group_listing();
foreach ($groups as $gid => $array) {
$result = db_fetch_array(db_query('SELECT * FROM {menu} where title = "%s"', $array['title']));
if (!isset($result)) {
$form_id = 'menu_edit_menu_form';
$field_values = array(
'title' => $array['title'],
);
drupal_execute($form_id, $field_values, $type, $mid);
$item_mid = db_result(db_query('SELECT mid FROM {menu} WHERE title = "%s"', $array['title']));
db_query('INSERT INTO {og_menu} (mid, gid, is_primary, parent_mid, weight) VALUES (%d, %d, %d, %d, %d)', $item_mid, $gid, 1, 0, 0);
}
else {
continue;
}
}
}