Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
After a group content type is created, changing the machine name and then re-saving the content type will cause the checkboxes on the OG Node - Group Permissions page to disappear. A message is set and displayed on the next page load that contains multiple errors like this one:
Warning: Invalid argument supplied for foreach() in element_children() (line 6282 of /og-sandbox/htdocs/includes/common.inc).
Changing the machine name back to the original name will fix the problem.
Comments
Comment #1
amitaibuCan you provide a patch please?
Comment #2
loopduplicateI wish I could but I don't know how to modify the code to fix the bug. I just worked around the bug by going to the edit form for the content type and changing the machine name back to the original one.
Comment #3
vanz CreditAttribution: vanz commentedGot the same bug with the latest 7.x-2.x-dev version and I was able to reproduce with a clean install and a dummy group. Bumping the priority a bit because it basically makes OG unusable with no workaround.
Unfortunately I can't provide a patch but I can test anything you need.
Comment #4
kristiaanvandeneyndeBoosting to critical as it breaks more than just that page.
When I changed the machine name of a content type, several admin pages of OG returned an "Access denied". Even as user 1.
Comment #5
havran CreditAttribution: havran commentedI have same experience in 7.x-2.0-beta3 - missing checkboxes, errors and access denied for use uid 1. I fix this with correcting machine name in table {og_role}.
Comment #6
amitaibuPatches are welcome. Renaming a node type isn't your typical action, so lowering to normal.
Comment #7
loopduplicateHi Amitaibu,
Thanks so much for all your hard work with OG. I will try to figure out a solution and submit a patch. I looked into it a little last weekend but got overwhelmed looking at the code :)
Cheers,
Loopduplicate
Comment #8
amitaibuloopduplicate, cool thanks.
Comment #9
appaulmac CreditAttribution: appaulmac commentedUnfortunately for me I couldn't remember what the original machine name of the Content Type was because I didn't see the problem until much later!
I removed the (single) piece of content that I had created (I'm just building the site, thankfully), then deactivated all of OG, flushed caches then reactivated OG and the checkboxes (and ability to access admin/config/group/permissions pages) returned. I've re-added the piece of content from before and everything is back to normal again.
Comment #10
scottsawyerI just wanted to weigh in on my situation and how I was able to resolve it.
First, I had the same problem running 2.3, and I have so many modules and so much content while I build out a migration. So arbitrarily deleting content types and removing modules was really not an option.
I noticed that I only had this error on one of 4 group types, all node groups of different content types.
I went to the offending content type and deleted my group_group field, which removed the group context of the type.
Returned to the OG permissions, the offending group type was not present, and no errors. Everything else appeared to work properly.
I went back to my content type, selected Group from the OG context, making this content type a Group once again. Upon returning to the permissions screen, the permissions form loads correctly.
Hope this helps someone, I didn't have to delete a bunch of content nor delete an entire content type.
Comment #11
justmad CreditAttribution: justmad commentedAfter a some hours research I solve this one re-inserting the og_rol rows
INSERT INTO `og_role` (`rid`, `gid`, `group_type`, `group_bundle`, `name`) VALUES
(1, 0, 'node', 'departments', 'non-member'),
(2, 0, 'node', 'departments', 'member'),
(3, 0, 'node', 'departments', 'administrator member');
I don't know how and why that ones was deleted.
Comment #12
jim.applebee CreditAttribution: jim.applebee commentedI had the same exact issue and #10 worked.
Thank you.
Comment #13
jarjar CreditAttribution: jarjar commentedThe problem happened to me as well. #10 worked for me. Thanks for sharing this tip.
I'm using 7.x-2.4 OG module version.
Comment #14
funklcph CreditAttribution: funklcph commented#10 also worked for me and saved my day. I'm also using 7.x-2.4 OG module.
Comment #15
MatthijsG CreditAttribution: MatthijsG commented#10 did also the job here. It also restored the permissions for anonymous users to see OG's.
So,
Oh, and .. i noticed how existing nodes lost their marked checkbox for group. I had to recheck the group (this is a group ..) checkboxes.
Comment #16
jonathanhuot CreditAttribution: jonathanhuot commented#10 'or TL;DR #15 worked for me.
Comment #17
1kenthomas CreditAttribution: 1kenthomas as a volunteer and commentedThis also seems to be a problem on upgrade (1.4 -> 2.x). Looking for more information / a solution, now.
Comment #18
Prashant Singhal CreditAttribution: Prashant Singhal as a volunteer commentedI had the same problem. I found this related blog thread : . See #13 for manual resolution. Also there is a patch submitted for this issue on #16 but its in review. I suggest to go for manual resolution, worked like a charm for me.
Comment #19
amitsedaiz CreditAttribution: amitsedaiz at Jagriti InnoHealth Platforms Pvt Ltd commented#11 by justmad worked for me. Thanks.