[OG FORUM COMPATIBILITY ISSUE] Required audience still doesn't allow forum topic post
joewang - December 13, 2008 - 02:50
| Project: | OG Forum |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Description
The previous fix worked fine until a certain point (I'm not sure when, but I did install OG_user_roles).
Now, if the audience is required, Drupal still gives the error "You must join a group before posting." Perhaps there is a cleaner fix for this problem? I sort of felt like the other fix was just a quick hack.

#1
I suspect this error still exists b/c OG_user_roles changes the node add url to node/ognodeadd from node/add
#2
I commented out the following lines:
$groups = $form['og_nodeapi']['visible']['og_groups'];$form['og_nodeapi']['invisible']['og_groups'] = array('#type' => 'value', '#value' => $groups);
unset($form['og_nodeapi']['visible']['og_groups']);
and the forum content type works like any other now. I sort of think that the code above "limits" the post to that specific group, but it wasn't working out.
#3
I finally took the initiative and dug around the code--I figured out another way to limit the user in terms of posting to a specific group.
Take a look at the patch: I haven't fully tested it, but it seems to work.
#4
Thanks Joe. Looking into this now ..
#5
Would you provide more details how to reproduce the problem and any references to other bug reports as your problem is no longer fresh in my mind.
Thanks Paul
#6
I have OG_User_Roles installed.
Here's what happens:
When the forum content type is a "standard group post" and audience is required, users are given a message: "You must join a group before posting."
After digging around the code (and comparing the output to other content types), I have realized that OG_Forum does something funky in restricting the user through form_alter:
$groups = $form['og_nodeapi']['visible']['og_groups'];$form['og_nodeapi']['invisible']['og_groups'] = array('#type' => 'value', '#value' => $groups);
unset($form['og_nodeapi']['visible']['og_groups']);
around this code is where the "Groups" fieldset is modified. While other content types still restrict the group when adding a new node, it doesn't restrict the user when editing. I sort of have a feeling that this was the original intention of these bits of code. In the patch above, I've cleaned up the way og_forum unsets the form controls.
I have only tried this with the audience required setting on, so I'm not sure how it effects the page the other way.
#7
Thanks Joe. Looking into this today ..
#8
Hi Joe,
I applied the patch to a setup matching your configuration but excluding OG_user_roles and at the bottom of the "Create Forum topic" group page the "Audience" section show a checkbox with no indication of what it means but with out the patch it doesn't show a checkbox just show the name of the group.
-Paul
#9
Have you tried it with og_user_roles? Maybe there is a way for both to work.
I know there are lines:
arg(1) == 'ognodeadd'#10
Taking out these two lines looks to resolve the problem
- $groups = $form['og_nodeapi']['visible']['og_groups'];
- $form['og_nodeapi']['invisible']['og_groups'] = array('#type' => 'value', '#value' => $groups);
I'll commit this change to the development branch and continue investigating .
#11
Please reopen if you need further assitance.
Thanks for your help.
Paul
#12
Your fix works only for creating a forum topic. Editing/deleting still gives the same error message: "you need to join a group"
My previous patch/fix, despite working only with ogur I guess, works in all cases.
#13
Working on this again now ..
#14
@Joe
I'll have to postpone this for a while as i need to focus on releasing an official release of OG Forum module that works with OG and there does not appear to be any problems with this OG Forum when OG User roles is not installed.
It sounds as though you have resolved your problems so i will postpone this bug for a short while and as soon as i have an official release out of the OG Forum module I will work with you on getting your OG User roles module better supported within OG Forum.
Best, Paul
#15
#16
#17