[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

joewang - December 13, 2008 - 04:19

I suspect this error still exists b/c OG_user_roles changes the node add url to node/ognodeadd from node/add

#2

joewang - December 14, 2008 - 00:47
Status:active» needs work

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

joewang - December 14, 2008 - 00:48

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.

AttachmentSize
ogforumpost.patch 2.26 KB

#4

paulbooker - December 17, 2008 - 16:13
Assigned to:Anonymous» paulbooker

Thanks Joe. Looking into this now ..

#5

paulbooker - December 17, 2008 - 16:33

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

joewang - December 17, 2008 - 21:58

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

paulbooker - December 18, 2008 - 11:41

Thanks Joe. Looking into this today ..

#8

paulbooker - December 18, 2008 - 15:09

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

joewang - December 18, 2008 - 22:20

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'
to check for og_user_roles. Perhaps we can work this in, because as of right now without the above patch, users cannot post to group forums with the og_user_roles module installed.

#10

paulbooker - January 7, 2009 - 17:54

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

paulbooker - January 8, 2009 - 14:26
Status:needs work» fixed

Please reopen if you need further assitance.

Thanks for your help.

Paul

#12

joewang - January 8, 2009 - 20:58
Status:fixed» active

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

paulbooker - January 19, 2009 - 10:54

Working on this again now ..

#14

paulbooker - January 19, 2009 - 11:56
Status:active» postponed

@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

paulbooker - April 27, 2009 - 13:47
Title:Required audience still doesn't allow forum topic post» [OG FORUM COMPATIBILITY ISSUE] Required audience still doesn't allow forum topic post

#16

paulbooker - May 18, 2009 - 12:58
Assigned to:paulbooker» Anonymous
Status:postponed» active

#17

paulbooker - May 18, 2009 - 13:00
Version:6.x-1.x-dev» 6.x-2.x-dev
 
 

Drupal is a registered trademark of Dries Buytaert.