I have a site where biblio content is set to be an OG standard group post. When adding content, all users get the first page with the publication type pull-down, but when users without "administer nodes" permission select a type, they get the error message "You must join a group before posting on this web site." even though they are members of multiple groups. Giving authenticated users administer nodes permission eliminates the error message. The error is also prevented if I change the content type's OG setting to "May not be posted into a group". I am fairly new to Drupal. Am I missing someting silly or is this a problem with biblio, OG or the communication between them. Thanks!

CommentFileSizeAuthor
#5 biblio-594520-6.patch535 bytesfuerst
#6 biblio-594520-6-6.x-2.x.patch491 bytesfuerst

Comments

ghosty’s picture

Did this ever get fixed. I have the same issue

rjerome’s picture

To be honest, I haven't looked into it. I'll see what I can do, but I'll have to setup OG in order to replicate it and fix it.

ghosty’s picture

I looked more into the code and found the following:

if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) {

It's inside this statement that you get the error "You must join a group before posting on this website." Looking at the statement, the following 3 conditions must be true for you to get the error:

1. The form must be in a content type assigned to an organic group and be a post.
2. The organic group audience must not be required.
3. The user must not have administer node privs.

Now I was getting your error until I saw that another module I was using, OG Audience By Type, was removing the required setting for my groups. I forced the form to require an audience type and now I do not get this error. Check to see which modules you are using that might show the same conflict.

Hope this helps.

fuerst’s picture

Reason is IMHO: In biblio_form_alter() all form elements not belonging to Biblio will be removed. That's what triggers the error because Organic Groups is missing the $node->og_groups variable in it's hook_nodeapi() validate section which is called once you change the Publication Type which actually is a form submit.

To validate this I just changed

  if (strstr($form_element, 'biblio_')) continue;

to

  if (strstr($form_element, 'biblio_') || strstr($form_element, 'og_')) continue;

in biblio_form_alter() (Biblio 6.x-2.0-beta3) and it worked.

I don't understand yet why Biblio is removing all form elements except it's own so I did not make a patch from it.

fuerst’s picture

Version: 6.x-2.x-dev » 6.x-1.7
StatusFileSize
new535 bytes

I guess non-biblio form elements are hidden because of esthetic reasons. It may be better to hide non-biblio form elements by denying access instead of removing them which may crash other modules like OG. Attached patch tries to solve the issue by using the #access Form API property.

Update: Uploaded the wrong patch: biblio-594520-6.patch is for Biblio 7.x-2.x-dev.

fuerst’s picture

Version: 6.x-1.7 » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new491 bytes

Patch for 6.x-2.x

rjerome’s picture

Version: 6.x-1.7 » 6.x-2.x-dev

Good idea, has anyone tested it with OG to see if it resolves the original issue?

fuerst’s picture

I'm afraid you will not get a response when asking for OG/Biblio related issues. AFAIK using the #access property is the proper way to hide. Hiding it that way may help other modules too, not only OG.

Chuckler29’s picture

Original poster back after several years. Back in the day I hacked the module and got it working, but today someone tried the DOI import and had the same problem. I applied the switch to using #access from the patch above and it fixed the problem. Downside, is the "don't send notifications" control now appears on the first form page, but that is no big deal. FYI, I'm using Biblio 6.x-1.7 and OG 6.x-2.1

Thanks for the work on this module!!

fuerst’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the report - we can set it to RTBC now.

rjerome’s picture

Status: Reviewed & tested by the community » Fixed

OK, I've pushed that change to the repository...

http://drupalcode.org/project/biblio.git/commit/5d2143c

Thanks for the feedback.

Ron.

Status: Fixed » Closed (fixed)

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