Group menu not created automatically
imrook - January 7, 2008 - 17:41
| Project: | OG Menu |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
When a user who is a member of a group without a menu visits "admin/build/menu", og_menu fails to create a new menu for that group. I found this to be because isset() is being called on the result of the db query. db_fetch_array returns (boolean) false which evaluates to true when passed to isset(). I found that using empty() instead of isset() works as expected. I'm using PHP 5.2.1. Here is a patch to change the appropriate line.
--- og_menu.module.orig 2008-01-07 12:30:59.000000000 -0500
+++ og_menu.module 2008-01-07 12:31:11.000000000 -0500
@@ -340,7 +340,7 @@
foreach ($groups as $gid => $array){
$result = db_fetch_array(db_query('SELECT * FROM {menu} where title = "%s"', $array['title']));
- if (!isset($result)){
+ if (empty($result)){
$form_id = 'menu_edit_menu_form';
$field_values = array('title' => $array['title']);
drupal_execute($form_id, $field_values, $type, $mid);
#1
imrook !
I had the same bug , and this solved the problem !
Thank you very much
Avior
#2
Once I get a chance to test it I will change it and put it in a future release.
#3
Thank You very much!!