Loosing group context on node/add paths
| Project: | OG Forum |
| Version: | 6.x-2.0-rc4 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | paulbooker |
| Status: | active |
I apologize if this has already been reported. I have not been able to locate a report on this specific issue.
The OG_Forum module is consistently causing some group context problems when enabled.
Specifically, when using the group menu in the left column to create content (any content, but in this example a blog entry), the group context is consistently switching to the first group in my group list.
For example, I am on group page C. I select "Add Blog entry" from the menu item in the left column under the "C" menu. This brings me to the page:
http://vcp.ics.uci.edu/node/add/blog?gids[]=462
Where 462 is the id for group C. However, when this page comes up, the context switches over to Group A. In my case, group A was the first group added, therefore has the lowest id number, and is the first in an alphabetic listing.
Once the new content is saved, the page pops back into the group C context.
Has anyone had the same problem?
Thank you,
-- Kari

#1
I have been able to replicate this problem, anybody else ?
#2
@kari.nies, are you sure this is caused by og_forum, ie. if you disable the og_forum module, does the problem immediately go away?
#3
Yes, the problem went away when I disabled og_forum module.
#4
Hi Paul,
So you were able to reproduce it?
I just tested this out on my windows dev site that I use to test out modules and I cannot replicate it there. It is happening consistently on my live unix site where a user had reported it. The module set between the two sites are nearly identical. I will comb through it and see if I can't find another module that might be triggering this behavior.
BTW, still happening on the 6.x-2.0-rc5 release. I noticed the discrepancy across my dev and live site when testing out this newer version.
-- Kari
#5
Hi Kari,
Were you able to resolve your issue ?
Best, Paul
#6
Not yet. I had disabled the module. Just tried it out again and it is no longer affecting my devel site, but it is still a problem on the live site. I'll upgrade to 6.x.2.0 and try it again on both sites.
#7
After the upgrade the context problem is still there on my live site.
#8
Kari, Did you get to the bottom of this issue?
#9
We have a patch for this. Would appreciate if someone could try it out.
#10
I just tried it this afternoon. It does appear to fix the context switching problem that I was experiencing on my live site.
Thanks!
-- Kari
#11
Thanks for this mplanchant. It looks like you've found the offending function but I think the functionality you've added is already provided by the 'prepare' case in og_forum_nodeapi. It looks to me that the issue that Kari is having might be caused by the group context being set here when this function should provide access checks only. Maybe the function should be reduced to:
<?php
function og_forum_access_forum_page($tid = 0) {
if (!user_access('access content')) {
return FALSE;
}
global $user;
if ($tid != 0) {
$gid = og_forum_gid_from_tid($tid);
if (!empty($gid) && (!(!empty($user->og_groups) && array_key_exists($gid, $user->og_groups)) && !(user_access('administer forums')) && !og_forum_is_public($tid))) {
return FALSE;
}
}
return TRUE;
}
?>