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

amitaibu’s picture

Can you provide a patch please?

loopduplicate’s picture

I 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.

vanz’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.x-dev
Priority: Normal » Major

Got 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.

kristiaanvandeneynde’s picture

Priority: Major » Critical

Boosting 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.

havran’s picture

I 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}.

amitaibu’s picture

Priority: Critical » Normal

Patches are welcome. Renaming a node type isn't your typical action, so lowering to normal.

loopduplicate’s picture

Hi 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

amitaibu’s picture

loopduplicate, cool thanks.

appaulmac’s picture

Unfortunately 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.

scottsawyer’s picture

I 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.

justmad’s picture

After 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.

jim.applebee’s picture

I had the same exact issue and #10 worked.

Thank you.

jarjar’s picture

The 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.

funklcph’s picture

#10 also worked for me and saved my day. I'm also using 7.x-2.4 OG module.

MatthijsG’s picture

Issue summary: View changes

#10 did also the job here. It also restored the permissions for anonymous users to see OG's.

So,

  • go to your conflicting OG contenttype
  • delete the group_group field
  • go to admin/config/group/fields
  • (your conflicting contenttype has no field with group)
  • select in Bundles the correct contenttype
  • Choose field group under section group & add field

Oh, and .. i noticed how existing nodes lost their marked checkbox for group. I had to recheck the group (this is a group ..) checkboxes.

jonathanhuot’s picture

#10 'or TL;DR #15 worked for me.

1kenthomas’s picture

This also seems to be a problem on upgrade (1.4 -> 2.x). Looking for more information / a solution, now.

Prashant Singhal’s picture

I 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.

amitsedaiz’s picture

#11 by justmad worked for me. Thanks.