This issue is related to #345762: Empty Audience with OG 6.x-2.0.

Attached a patch that fixes this issue by going recursively through the #options list.

Comments

kasiawaka’s picture

I have this problem: if user belongs to more then one group, the Audience list of groups is empty when user tries to create any content in the group.

To verify this problem, I installed a completely empty site and I have the same problem there.

Here are the steps to re-create it.
- Drupal 6.14
- og 6.x-2.0
- og_content_type_admin 6.x-1.12
- views 6.x-2.7
- admin_menu 6.x-1.5

Enabled in /admin/build/modules:
- Administration menu
- Core modules with no changes
- OG Content Type Admin
- Organic groups
- Organic groups access control
- Organic groups Views integration
- Views
- Views UI

Created new content type called Group.
On Organic Groups configuration page (admin/og/og) made Group a "Group node", Post and Story a "Standard group post".
Didn't change any other settings here.

On OG Content Types page (admin/og/og_content_types):
- Site Wide: for all content types (Group, Story and Page) added checkmarks unser Allow and Require
- Default: News and Page are marked as Allow

I created 2 groups:
- Group One
- Group Two

Added users: kevin and jeff.
Added kevin to Group One and Group Two.
Added jeff to Group One.

When kevin creates content in Group One (create Story), the Audience list of groups is empty.
When jeff creates content in Group One (create Story), the Audience is defaulted to Group One.

The only difference between those 2 users is that kevin belongs to more then 1 group. I tested it on the other site and I got the same problem. If the user belongs to more then 1 group, the Audience list of groups is empty.
The additional weird thing is that when the user is an admin of the group, even if he/she belongs to several groups, that one group will be always available under the audience, but others, in which he/she is a member, are not.

I disabled OG Content Type admin module, rebuild permissions (admin/content/node-settings) and flushed cache and the problem is gone.
So it seems to be a problem with OG Content Type.

I will try the patch above and report on results.

kasiawaka’s picture

The patch above didn't solve my problem.

Jeff, my co-worker, fixed it by changing in og_content_type_admin.module, around line 1112, replaced

if (empty($activated_types->{$type})) {
  unset($form[$nid]); // remove the checkbox to add this content to the og
}

with

if (empty($activated_types[ $form['type']['#value'] ])) { /* ALTERED: $activated_types is an associative array  */
   unset($form['og_nodeapi']['visible']['og_groups']['#options'][$nid]);
}

Now the Group Audience works properly.

tuwebo’s picture

Same problem here,
I have the same problem, but the wierd thing is that it is working on my local computer (using MAMP).
Could be this a server configuration problem?

AntiNSA’s picture

subscribe

vanhanit’s picture

Version: 6.x-1.1 » 6.x-1.2
StatusFileSize
new2.51 KB

Well, according to the original code $activated_types is an object, but accessing properties on objects and associative arrays with the index operator ([index]) works for both the same way.

I updated my patch for the latest version, see attachment.

AntiNSA’s picture

Anyone tested this patch? When can it be rolled into a new release?

ronaldmulero’s picture

Patch in #5 worked for me. Thanks :)

AntiNSA’s picture

when is next dev?

joostvdl’s picture

Patch in #5 is also working for me.

Drupal 6.16
OG-6.x-2.1
OG_CONTENT_TYPE_ADMIN-6.x-1.2

tallsimon’s picture

please roll in dev? I will have to stop using this brilliant module otherwise!

AntiNSA’s picture

why not roll dev?

Anonymous’s picture

Assigned: Unassigned »

I have committed this patch to the development branch.

Would you please confirm that this problem is resolved as i have not looked into this problem deeply.

Best,
Paul Booker
Appcoast

AntiNSA’s picture

Thanks!

tallsimon’s picture

Yes works well on my site, thank you very much vanhanit & paulbooker.
Anyone else tried it? Then it can be marked as fixed...

TC44’s picture

StatusFileSize
new7.76 KB

Not sure if this is on topic here, but I'm using the latest current dev of OG and Content Type Administration by Organic Group, and I've got no audience boxes showing, except for drupal user 1.

Audience is enabled and required. It did show up once right after I set it to required and went to add the node, but I then refreshed the edit form and it dissappeared and didn't show up again.. I'm assuming the latest dev has the patch rolled in already?

I'm completely stumped. I've had this working prior.. I tried reverting, updated the db, ran cron etc. no luck. In the attached screen grab, there should be 2 groups that show up under audience.

TC44’s picture

#15 was fixed for me after a removal and reinstallation. Works fine now.

ihsanullahkhan’s picture

I have the same problem audience is empty online but working on my local machine. How to the patches like in this group. there are some patches.

ihsanullahkhan’s picture

aguskii, have solved this problem, I facing the same problem that on my local I can see the audience but on server I can not see the audeince.

Bezerik’s picture

The path in comment #5 is working perfectly.

Tested in my drupal with 21 groups, 7 roles and more than 30 users width workflow and other stuff.

Drupal 6.16
Organic groups 6.x-2.0
OG User Roles 6.x-4.1
Content Type Administration by Organic Group 6.x-1.2

Thanks for the patch!!!!

Greetings from barcelona!

tallsimon’s picture

Status: Needs review » Fixed

good then :-)

ryanellis’s picture

The latest DEV (11 Jul 2010) works for me.
Thanks for your support.

AntiNSA’s picture

Is there really a dev release on that date? That is the date of error dev packaging....

ryanellis’s picture

What ever date it is - heres the DEV that worked for me! - https://drupal.org/node/315981

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

baff’s picture

Latest dev version and still audience is empty except for user 1 - I deinstalled everything completely (deleting tables, variables ) and installed newly - problem still there.

It was working, but after using the following patch http://drupal.org/files/issues/og_content_type_admin-group_details-69782...
the problem is there, although I think it has nothing to do with the patch.

I removed patch, problem still there.

suit4’s picture

The current DEV (6.x-1.x-dev, January 2011) version again has the same issue, as well as the current recommended version.
To me, it seems to be a bug in og_content_type_admin.module at abot line 1129:

The current DEV-Version reads

if (empty($activated_types->{$type})) {
            unset($form[$nid]); // remove the checkbox to add this content to the og
          }

and does NOT work, Audience checkboxes are blanked, whereas

this code

if (empty($activated_types[$type])) {
            unset($form[$nid]); // remove the checkbox to add this content to the og
          }

works.

Looking more closer: $result is fetched from DB as an object, but the desired value inside result, which is $result->types_active, is a serialized array.
Mine reads

a:1:{s:14:"myarcticletype";i:2;}

... and a is for array, so using $activated_types[$type] for getting the values should do the right thing.

ggevalt’s picture

Status: Closed (fixed) » Needs work

My apologies...

I am editing my original post that indicated that the problem persisted in this module.

I somehow missed the reference above to the patch. The patch works. The problem is solved. I have now reinstated the module, done some tests and all is right with the world.

Thanks so much.

geoff

ggevalt’s picture

Status: Needs work » Closed (fixed)

restating this as fixed

ken hawkins’s picture

Just a heads up to others (and my future searching) that this patch isn't yet in the current DEV release as of my comment timestamp.

baff’s picture

Thanks for your info

jvieille’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Status: Closed (fixed) » Reviewed & tested by the community

Update and clarification:
- Patch #15 is applied to the latest dev
- this still does not work
- it needs to apply the change in #26 to make it working.

Please commit this nine months old fix!!!

pvasener’s picture

Subscribing

jvieille’s picture

Please!