I am a newbie running drupal 5.x on a system running PHP 5.1.6 and trying to set up CTA by OG 5.x-1.0 to help manage navigation in the group blocks. The initial install went smoothly and I configured site-wide and default content type settings. Initially I chose to use the option to disallow group admin's from changing settings (on the assumption this would mean it would be unnecessary to configure individual groups). But when I visited a group page I was still prompted to manage group content types.

When I followed the manage group content type link, the following error appeared:

warning: Invalid argument supplied for foreach() in /public_html/sites/all/modules/og_content_type_admin/og_content_type_admin.module on line 547.

Thinking this might be a problem caused by selecting the disallow option, I went back and deselected that option in the default setup, but still when I visit the Manage Group Content Type page, I get the same error.

Any ideas of how to fix this?

Thank you

Comments

rconstantine’s picture

Assigned: Unassigned » rconstantine
Category: support » bug

Hmm, I'm not sure about the error message. I just got rid of all monitored groups on my test box, except 'site-wide' and 'default' and didn't get the error message when clicking on the link. I was running as user 1. Were you? However, you're right: the link shouldn't be there if the 'disallow' checkbox is checked. I'm fixing that now. I'll make some changes and commit to HEAD, then I'll put out a dev release. I'll also take a look at line 547 to see if there is some checking I can do to make sure a foreach isn't run if there's nothing to run (since that seems like the most likely problem).

So after I commit the changes, let me know if you still have a problem, doing whatever you did the first time, and we'll go from there.

I'll post an alert here when I've posted the new release.

rconstantine’s picture

I've released the MAIN branch. It should show up within 12 hours (according to drupal.org). It fixes the menu issue, but not the foreach thing. check your database if you can and make sure that the table og_content_type_admin is there and that there are serialized strings in both types_allowed and types_active. Looking at the code, it seems it should only crap out right there if there is no array, meaning, no data to unserialize. There should only not be data if you either have no content types activated when you activated my module, or there was a problem with the install script. If that turns out to be the case, then there may have been an installation problem that we'll need to track down. Are you using MySQL?

Anyway, for now, download the updated (unofficial release), test the menu thing, and let me know about your DB.

femrich’s picture

Thanks for the help. Yes, I am working as user 1. I will check the MAIN branch file to see if it looks like the correct one (I think it is now only about 8 hours since you posted) and update once it seems so. As for looking at the database functions, I usually check that with PHPMyAdmin. The system I am on runs MySQL, but I am not up to speed on the workings of the database beyond following some fairly simple instructions. But my ISP provides great service, and if I cannot do something myself (which is always the first thing I try) I am sure they could understand and implement the things you are recommending.

Thanks again, and I will check back to let you know how it goes.

femrich’s picture

Okay, prior to installing the updated module, I checked the database and confirmed that the table is there. Both types_allowed and types_active fields are present, but I am not sure how to tell whether there are serialized strings present. Under type (this in PHPMyAdmin) both say "longtext", collation is uttf8_general_ci, attributes are blank, null is no, default and extra are blank. I don't know whether any of that makes sense or not.

Now I will uninstall the previous module and install the update to see what happens...

femrich’s picture

Okay, here's what I did, logged in as user 1:

1) uninstalled CTAOG following the standard procedure in the Drupal admin modules window-received a successful uninstall message
2) navigated to my OG pages to see what they looked like and observed that now there was no navigation block for any group--only a "recently joined" and "group notifications" block
3) installed the new dev module. Observed that upon install it is listed in the modules screen with no "dev" trailing the filename. Activated the module.
4) configured site-wide, og default, and individual group settings to "allow" a handful of identical content types. Did not check the box that prevents the site owner from changing settings.
5) Navigated to my first group. This is where I saw the error message yesterday. Today there was no error message (yay!),
but
6) Neither was there a Manage Group Content link (I think there should be, no?)
7) Navigated to my three other groups and saw that 5 and 6 above are also present there.

As I look at my navigation menu in the groups, it seems I have neither the Manage Group Content link nor any links to create group content. Instead I have a main menu that has been changed now to include a "create general content" heading where "create content" used to be. I will be looking to restore this heading to the original, as I don't think it will help in the groups and it is surely confusing on the general site. The menu stays the same whether I am in a group or on the main site.

Anyhow, it seems like things are closer to possibly working, but still not functional. Any recommendations for next steps?

Thank you.

rconstantine’s picture

Thanks for checking this out.

First, you say

7) Navigated to my three other groups and saw that 5 and 6 above are also present there.

Do you mean that the error message is still gone and the link is missing? If so, that is how it should be. See http://drupal.org/node/128421. I just fixed the problem of having the link when it shouldn't be there. Basically, only group owners should see the link. So if your four groups are not owned by user 1, then not even user 1 should see the link. The reason being user 1 can set any content type to REQUIRED which would be nearly the same as going into each group and setting ACTIVATED. This is especially important when there are thousands of groups on a site. It would be too tedious for user 1 to navigate to each group and manage the content types. That's why REQUIRED exists in the main settings page. So try to log in as the group owner and make sure you can see the link then. Wait a minute... I just checked and what worked yesterday isn't working today. Even when logged in as group owner, I'm not seeing the link, so I'll check that again and upload as soon as it's fixed. Woah! What the...??? You're right, the entire group context menu is gone. I'll fix that, but I wonder if it's an OG problem with the newest OG. I'll roll mine back to check.

Anyway, next, if you are able to make changes to either the 'Site-wide' or 'Default' settings, and they are still there when the page reloads, then everything is working with your DB tables, so don't worry about investigating that further.

As for 'Create General Content', that is for creating site-wide content only, not in-group content. I changed the name of that menu item to better reflect that fact. You should be able to change it back in the menu admin if you don't like it. When it works, in-group content creation links should appear on the group context menu. Make sure you have it activated. That is the menu that the manage link should also be in. You should have links like 'Create Page' whereas those in the 'Create General Content' would just say 'Page'. These links come from OG and are only modified by my module. Only those ALLOWED and either REQUIRED or ACTIVATED will show up. So if you can't get to the individual group management page, try setting some types to REQUIRED to make sure they show up on the group menu. So I'll check things out and get back to you.

rconstantine’s picture

Ha ha ha. I forgot about something. Go to your blocks configuration page. Find the block called 'Group details override by OG Content Type Admin' and activate it and put it into your left sidebar. That was supposed to be configured at install, but it would seem that THIS is what is screwed up, not the other things. So activate it and report back whether you still have problems.

I'm going to fix the install issue with that block anyway. I'll do it as another issue.

rconstantine’s picture

Status: Active » Fixed

fixed.

@femrich, if you went to the blocks admin page and fixed things there, further uninstall/install iterations should be correct now. also, with the block being in the right place, you shouldn't have menu issues anymore.

this is provided the download file updates soon and you are able to get it. you are looking for the latest 5.x-1.x-dev released on the 28th of March, after 3:20pm pacific. you may have to wait for the cron job to run and update it. or go here: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/og_content_ty...

thanks for finding these problems.

btw, user 1 should now be able to see the manage link no matter whether they own the group or not.

femrich’s picture

Great! I downloaded and installed the new version, enabled the block, and voila! Thanks very much for your help on this. Now I will spend some time working with the module, but from what I see so far it will help a lot. Thanks again!

Anonymous’s picture

Status: Fixed » Closed (fixed)