Jump to:
| Project: | OG Forum |
| Version: | 6.x-2.0-rc4 |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | paulbooker |
| Status: | closed (fixed) |
Issue Summary
Well I read topics with similarities to this, but i didn't find any specific statement for exactly this issue:
When I go to the forums (/forum) and use the 'Post new Forum topic'-Link, I can chose all sitewide-forums in the "Forums"-List, where I have to chose the right destination-forum for my post. OK.
When I go to any group I'm a member of and click on the forum tab or group forums-link in the group details-block (node/X/forum -> reroute to -> forum/Y) I reach at the group-container with the group forums. When I use the 'Post new Forum topic'-Link there - in the container - the 'Forums'-List is empty and I can't post, because I can't chose any forum. Bug?
When I go to any subforum of the group-forum-container, I get the complete list, including the container itself - as it should be displayed in the above case. OK.
The following ways for users to post new forum topics don't work right:
- Navigation: Forums (/forum) -> container of group -> Post new Forum topic: Forums-list is empty
- Enter group -> forum-tab -> container of group -> Post new Forum topic: Forums-list is empty
- Enter group -> Group details-block: group forums-link -> container of group -> Post new Forum topic: Forums-list is empty
Greetinx,
Felix aka YAFA
Comments
#1
Changed to topic to better fit to the issue
#2
Investigating ..
#3
When I go to any group I'm a member of and click on the forum tab or group forums-link in the group details-block (node/X/forum -> reroute to -> forum/Y) I reach at the group-container with the group forums. When I use the 'Post new Forum topic'-Link there - in the container - the 'Forums'-List is empty and I can't post, because I can't chose any forum. Bug?
Yes, that's a bug. Thank you!
#4
This looks to be almost there, would somebody like to pick this up ..
function og_forum_preprocess_forums(&$variables) {if (isset($variables['links']['forum'])) {
global $user;
if ($variables['tid'] != 0) {
$gid = og_forum_gid_from_tid($variables['tid']);
//group forum link with group selected
if (!empty($gid) && (is_array($user->og_groups) && array_key_exists($gid, $user->og_groups))) {
$variables['links']['forum']['query'] = array('gids[]' => $gid);
}
}
}
_og_forum_set_breadcrumb($variables['tid']);
}
#5
Something like this might set the group context more reliably and the $user->og_groups wasn't really acheiving anything, eg. access control. Maybe this?
function og_forum_preprocess_forums(&$variables) {
if(isset($variables['tid']) && $variables['tid'] != 0) {
$gid = og_forum_gid_from_tid($variables['tid']);
if (!empty($gid)) {
_og_forum_set_group_context(node_load($gid));
_og_forum_set_breadcrumb($variables['tid']);
if (isset($variables['links']['forum'])) {
$variables['links']['forum']['query'] = array('gids[]' => $gid);
}
}
}
}
function _og_forum_set_group_context($group) {
og_set_theme($group->nid);
og_set_language($group);
og_set_group_context($group);
}
The empty forum list problem is related to the second part of #555964: Doesn't alow users to post, among others.
#6
Looks good to me, anyone else?
#7
Just wanted to comment circumstances:
Thank you very much for your work on these problems. If I had the time, I really would go further and suggest a fix with code.
Since I don't have the time, I try my best to describe the bugs as good as possible to make it easier for you to solve it.
Greetinx,
Felix aka YAFA
#8
Just noticed that og_set_theme should be passed the group node itself to save another node_load, ie:
<?phpog_set_theme($group);
?>
#9
Great work guys!
I'll commit these changes today.
Best, Paul