The way the group ids are retrieved in og_forum_query_term_access_alter() is incorrect because of an og 7.x-2.x change.

I've created a patch that corrects the issue and filters the query properly.

CommentFileSizeAuthor
#4 taxonomy_access-2009446-4.patch1.73 KBhoersche
#1 taxonomy_access-2009446-1.patch3.13 KBAnonymous (not verified)

Comments

Anonymous’s picture

StatusFileSize
new3.13 KB

Patch attached

ibullock’s picture

Patch didn't apply cleanly for me (probably because I have patched the module about 4 other times), but I did want to note that this fixed and issue for me where forums produced a 404 error for anonymous users.

PascalAnimateur’s picture

The patch applies ok, but it generates an error because the variable $user_groups is not initialized (just change the line above to $user_groups instead of $groups and it works).

But the patch doesn't do what it's supposed to do.. the group forum is still visible to non-members in the forum listing.

Anybody managed to hide the forums for non-members ?

hoersche’s picture

Issue summary: View changes
StatusFileSize
new1.73 KB

Patch attached that incorporates the needed above patch, fixes the $user_group variable, and fixes an OG 2.x renaming issue in og_forum_query_term_access_alter (og_group_access should be og_group_ref) that was causing nothing to match the forum taxonomy terms used to restrict access.

reswild’s picture

The patch in #4 worked for me for fixing what is shown on forum list pages, but in order to get the right access control for the forum posts themselves, I also had to change the following line in og_forum_form_forum_node_form_alter() (at line 170):

from
$user_group = og_get_entity_groups();
to
$user_group = og_get_groups_by_user();

jojonaloha’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of #1844104: non-group-member can post in private forum since it is older and handles both issues with taxonomy term access and the node access.