Closed (fixed)
Project:
Organic Groups Menu (OG Menu)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2012 at 21:46 UTC
Updated:
11 Dec 2016 at 20:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bulldozer2003@rv0
With changing the schema, should we include an update script, or is that not necessary since this is a dev branch without a stable release?
Comment #2
zipymonkey commentedI say please include an update script.
Comment #3
rv0 commentedboth hook_update_N and hook_schema are needed in .install file
its not that much work though
already a lot of people are using the dev branch, we cant just ask them to update their db's manually
Comment #4
bulldozer2003Comment #5
bulldozer2003This patch takes care of updating the schema with group_type and storing the new data as well. I also rewrote some of the code to handle storing and processing group_type data.
Still, though, a lot of work remains to move this module entirely to entity from node including switching hook_node_* to hook_entity_*
I tested out most module functions and everything seems to be working.
Comment #6
bulldozer2003I wanted to use db_change_field, but it doesn't allow moving columns (the FIRST syntax). Looking back on it, this code might be too mysql specific.
Column order doesn't matter in the modules code currently, but I wanted to put menu_name first cosmetically, since it is the primary key. Perhaps I should have simply added group_type onto the end and called it a day. Thoughts?
Schema before:
gid (key) | menu_name (key)Schema after:
menu_name (key) | gid | group_typeOr just tack group_type onto the end and change the primary key:
gid | menu_name (key) | group_typeComment #7
bulldozer2003Any eyes on my patch in comment #5?
I know it is a big update with a lot of changes. One big change is in og_get_group_menus():
I chose to alter the parameter in this way because 1) we need to get the bundle type and 2) it allows using the result of og_get_entity_groups without alteration.
I know the rest of the module doesn't support using non-node entity types, but anything we can do to slowly bring us toward that goal is good I think.
Comment #8
zipymonkey commentedFinally got a chance to test this out. I found the following:
Comment #9
bulldozer2003Thanks for the testing. I'll check 1 and 2 out. Number 3 is one of the many things that still need to be fixed to support group_type, this patch is just a stop along the way IMHO.
Comment #10
rv0 commentedAs for 3)
Maybe we should integrate with Better Automcomplete (BAC) like linkit does.
http://drupal.org/project/linkit
https://github.com/betamos/Better-Autocomplete
http://drupal.org/sandbox/sven.lauer/1777988
Comment #11
bulldozer2003RE: @zipymonkey
Fixed the typo, I could not replicate point 2, the group_type is defined in the form and I was able to add and edit menus without any issue.
Comment #12
zipymonkey commentedTested out the new patch. 1 is solved, and I also could not duplicate 2.
Comment #13
bulldozer2003Just wondering if anyone is thinking about commiting this or if there are concerns.
Comment #14
rv0 commentedThanks for the heads up
been too busy with other things and forgot about this.
Committed. Let's see where this goes :)
Comment #16
tom robert commentedI'm having the same problem as in #8 issue 2 :
When I attempt to save a menu (/admin/structure/menu/manage/[menu-name]/edit) I get an error message (Notice: Undefined index: og_menu_group_type in og_menu_edit_menu_form_submit() (line 865). Looks like this form is missing the group_type.
This happens when I create a new menu by the normal drupal way of adding menus (/admin/structure/menu/add).
When i looked at the code. The form is altered and og_menu_edit_menu_form_submit handler is added.
But the gid is not required and when provided it is of format "groupname [gid:XX]". The group_type is not provided.
The other form (og_menu_edit_menu_form) that also uses this submit handler provides the correct values for this submit handler.
The function og_menu_update_menu in og_menu_edit_menu_form_submit is always executed even when not in a og context.
I made a workaround patch that handles the extra checks, but maybe this should be reevaluated, so that the gid is always provided in the same format, the group type is always present and only executed when needed.
Comment #17
rv0 commented@Tom Robert
Thanks for that patch.
I restored part of the code from 7.x-2.x which also seems to be working.
It's a similar approach, but a different regex. Too tired now to look into it but it worked and it still does.
You are right that it should be reevaluated.
The autocomplete and select "widgets" there should be made $group_type aware so that non-node entities can be used.
This turned out to be not so simple in the current og, hence this change is postponed in favor of just fixing this bug.
Fix has been committed:
http://drupalcode.org/project/og_menu.git/blobdiff/8ea2a6c8627a32725851a...
Comment #18
bulldozer2003Woah, creating new menus is failing miserably for me now. Menus added for a group are being added as standard menus, but the og_menu is still being written to the database. It looks like maybe they're just being named incorrectly.
Editing them via admin/menus and adding an OG re-associates them, but I still have the zombie entires in the group>menu list.
Comment #19
bulldozer2003I think we should keep a 'menu-og-' . $menu_name convention for menu machine names.
Comment #20
rv0 commented@bulldozer2003
What happens if someone affiliates an existing menu with og? We wont change the machine name there, so we cant just assume all og menus follow this naming convention.
If you look at the diff, I actually restored the og-menu naming convention: http://drupalcode.org/project/og_menu.git/blobdiff/8ea2a6c8627a32725851a...
EDIT:
Can you please provide the exact steps to replicate this?
Comment #21
bulldozer2003Adding menus from group/%/%/admin/menus/%/add created the menu but the entry in og_menu database table did not match the menu table menu_name. The og_menu menu_name was menu-og- the menu table menu_name is menu-
Comment #22
bulldozer2003Created a new issue: #1888412: Menus added from group/%/%/admin/menus/add named incorrectly
Comment #24
azinck commentedI opened a new issue to move towards supporting arbitrary entity types as groups: #2270725: Make OG Menu work with any type of group entity
Comment #25
xjm