Conditions:
1) node_gallery_gallery is set to be standard group post
2) node_gallery_image is set to be standard group post
3) In admin/og/og, Audience Required is set to be TRUE

When I create a gallery within a group, and try to mange images in node/[nid]/images page, I will get an error: You must join a group before posting on this web site.

Reason: in node_gallery_pages.inc:

function node_gallery_manage_images_validate($form, &$form_state) {
  if (!empty($form_state['values']['images'])) {
    foreach ($form_state['values']['images'] as $nid => $image_form_state) {
      node_validate($image_form_state['edit_form'], $form['images'][$nid]['edit_form']);
    }
  }
}

$image_form_state['edit_form'] does not contain og_groups attribute.

So, in function og_nodeapi,

function og_nodeapi(){
 ...
 case 'validate':
      // Ensure that a group is selected if groups are required. needed when
      // author has no groups. In other cases, fapi does the validation.
      if (og_is_group_post_type($node->type) && variable_get('og_audience_required', FALSE) && !user_access('administer nodes')) {
        if (!isset($node->og_groups)) {
          form_set_error('title', t('You must <a href="@join">join a group</a> before posting on this web site.', array('@join' => url('og'))));
        }
      }
 ...
}

once og_audience_required = 1, it will send out this error.

CommentFileSizeAuthor
#7 1228498-7-og-required-audience.patch1.09 KBjustintime
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justintime’s picture

If you check the box next to "Groups" in the "Manage images tab settings" fieldgroup located at admin/settings/node_gallery/relationship/settings/1 (if you're using the default relationship), does that work around the problem?

foredoc’s picture

No, it does not.

justintime’s picture

Category: support » bug
Status: Active » Postponed (maintainer needs more info)

First, bear with me, I'm new to OG.

When you and I first started working on this, I wondered why we were setting gallery images as standard group posts. You know OG better than I, so I just went with the flow.

However, the more I think about it, I think that's the wrong way to do it. There's never really any use case I can think of where a image would be part of a different group than a gallery would be, is there?

With our setup with hook_nodeapi(), there is no way an image can *not* inherit the parent gallery's OG settings, so I think it's redundant, and I think it's causing extra work.

On a hunch, I set the node_gallery_image content type to "May not be posted into a group", and the problem you reported went away without changing any code. I couldn't find any new issues wrt OG when I was operating under this setup. It would be easy to remove the option to configure OG settings on the node_gallery_image content type to prevent people from getting into this situation.

Can you run this setup through your workflows and let me know if it works out for you? If so, we can just document this and hide the settings.

Marking this as a bug (since OG integration is part of core) and as needs more info until I hear back from you that this does or does not work.

foredoc’s picture

I confirm that if we change node_gallery_image content type to "May not be posted into a group", the problem mentioned in this thread will be gone.

However, by doing this, we are introducing other problems, which are Breadcrumbs inconsistency, and Group Context inconsistency.

Say, I have a group: mygroup,
a gallery in this group: mygallery
an image in this gallery: myimage.png

On the view page of the image:

Breadcrumbs inconsistency
1) with node_gallery_image as "standard group post",
Breadcrumbs: Home > Groups > mygroup > mygallery
2) with node_gallery_image as "May not be posted into a group",
Breadcrumbs: Home > Gallery List > My Galleries > mygallery > myimage.png. Since the group member is browsing an image within a group gallery, I assume "Home > Groups > mygroup > mygallery" makes more sense.

Group context inconsistency
1) with node_gallery_image as "standard group post",
Group Context: By viewing/editing the image, the user will still stay within the group
2) with node_gallery_image as "May not be posted into a group",
Group Context: By viewing/editing the image, the user will have to leave the group, which means the user have to step into this group again, in order to do other things within it.

Does this make sense to you?

Thanks.

justintime’s picture

Yep, makes perfect sense. So much for taking the easy way out :) I'll see what I can come up with. Whatever I come up with, it will be easier to fix our form than fix the side-effects you mentioned in #4.

justintime’s picture

Status: Postponed (maintainer needs more info) » Active

setting back to active

justintime’s picture

Status: Active » Needs review
FileSize
1.09 KB

Give this a shot.

foredoc’s picture

Still have the problem with #7 patch applied.

Thanks

foredoc’s picture

Did not apply the patch(#7) correctly. And I confirm that the patch in (#7) solve the problem.

Sorry about #8

Thanks.

justintime’s picture

Status: Needs review » Fixed

No worries, thanks for testing. Committed to dev.

Status: Fixed » Closed (fixed)

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