Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | 1228498-7-og-required-audience.patch | 1.09 KB | justintime |
Comments
Comment #1
justintime CreditAttribution: justintime commentedIf 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?
Comment #2
foredoc CreditAttribution: foredoc commentedNo, it does not.
Comment #3
justintime CreditAttribution: justintime commentedFirst, 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.
Comment #4
foredoc CreditAttribution: foredoc commentedI 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.
Comment #5
justintime CreditAttribution: justintime commentedYep, 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.
Comment #6
justintime CreditAttribution: justintime commentedsetting back to active
Comment #7
justintime CreditAttribution: justintime commentedGive this a shot.
Comment #8
foredoc CreditAttribution: foredoc commentedStill have the problem with #7 patch applied.
Thanks
Comment #9
foredoc CreditAttribution: foredoc commentedDid not apply the patch(#7) correctly. And I confirm that the patch in (#7) solve the problem.
Sorry about #8
Thanks.
Comment #10
justintime CreditAttribution: justintime commentedNo worries, thanks for testing. Committed to dev.