I have created a patch file that adds an additional option for hiding all organic forums/containers on the main forum display and also on the main select list when creating a new topic. My motivation was because the query which allows organic forums to work along normal forums is super slow when there are many organic groups on the site (each group equally at least 1 new term). For example on the project this patch was created on had about 4,100 groups and similar number of organic forums. The query consistently took over 2 minutes, with proper indexing setup. This was bench marked on 2xQuadCore (2.8GHz) with a 10,000RPM hard drive and 8GB of memory.

Please have a look over this, there are probably improvements that can be made. I appreciate any feedback as to the slow query matter as well.

Thanks,
Rob

CommentFileSizeAuthor
og_forum_main_display_patch1.patch7.57 KBbobooon

Comments

Anonymous’s picture

Assigned: Unassigned »

Thanks for the work done here Rob.

Very interesting , this is a priority for me tomorrow.

Best, Paul

Anonymous’s picture

Priority: Normal » Critical
Anonymous’s picture

With this patch installed if you go to node/add/forum to create a site wide forum post the forum select box list all of the group forums.

I think at the site wide level the forum select box should just show only site wide forums ?

Best, Paul

Anonymous’s picture

If we were to only show site wide forums outside of groups and continue to show only
group forums inside groups then it looks as though we can simplify
og_forum_db_rewrite_sql() as follows ...

function og_forum_db_rewrite_sql($query, $primary_table = 'n', $primary_field =
'nid') {

  if ($primary_field == 'tid') {
    if (!$_GET['gids']) {
      $return['join'] = "LEFT JOIN {og_term} ogt ON t.tid = ogt.tid";
      $return['where'] = "ogt.nid IS NULL";
      $return['distinct'] = TRUE;
      return $return;
    }
  }
} 

Any feedback would be really appreciated ?

Best, Paul

bobooon’s picture

That should work. However, sometimes users may assign a common container to put all the organic forums under. If that is the case you would also have to hide that using a little more code sense it does not have an entry {og_term}. For example:

// Hide all forums inside the default container, if set.
if ($og_forum_container = variable_get('forum_default_container', FALSE)) {
  $return['where'] = "t.tid != $og_forum_container";
  return $return;
}

This could probably be merged into your example above, like so:

$return['join'] = "LEFT JOIN {og_term} ogt ON t.tid = ogt.tid";
$return['where'] = "ogt.nid IS NULL";
$return['distinct'] = TRUE;
if ($og_forum_container = variable_get('forum_default_container', FALSE)) {
  $return['where'] .= " AND t.tid != $og_forum_container";
}
return $return;

Let me know if you think that makes sense.

Anonymous’s picture

Thanks Rob, altogether that feels like a much better solution.

Anonymous’s picture

I think most people will not expect to to see their group forums when they are making a sitewide forum post. So what i think we should do is to only allow group forums to show up in a group context and later we can reintroduce group forums in a site wide context as a configuration alternative only when the SQL SUBSELECT's have all been rewritten as JOIN's

I'll commit these changes to the development branch

Best, Paul

Anonymous’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

highvoltage’s picture

Uhh, I hate to sound dense here, but OG forums are still listed in the main forum index as of the latest release, and I don't see any option under admin/og/og_forum to set them to private. Bizarrely enough, there are options to set them to public, which they already are.

\o_O/

primus’s picture

Category: feature » bug
Status: Closed (fixed) » Active

Greetings

After applying the patch (og_forum_main_display_patch1.patch) it did as expected and hid the group forums from the public forums, but now when I goto post in any of the group forums the select box "Forums" does not show the group forum as an option, so I can only post to one of the public forums. Any suggestions on how to troubleshoot? Thanks.

Anonymous’s picture

It looks as though this work had been reversed. Investigating ..

Anonymous’s picture

"Uhh, I hate to sound dense here, but OG forums are still listed in the main forum index as of the latest release, and I don't see any option under admin/og/og_forum to set them to private. Bizarrely enough, there are options to set them to public, which they already are."

A user currently sees sitewide forums and the og forums for groups that the user is subscribed too on the forum/ page. Hope that helps

Breakerandi’s picture

Would be nice if this feature will be ported to drupal 6

Anonymous’s picture

Assigned: » Unassigned
optidel’s picture

This patch is supposed to have been reversed as per #12 but in fact it is very much present in 6.x-2.0 the current recommended version. This is not allowing us to create topics in OG Forum. See #651672: Non-members unable to create new topics

Anonymous’s picture

The patch was never committed only the code under #5 and then some later improvements

optidel’s picture

The code under #5 should not have been committed without the additional option for hiding all organic forums/containers on the main forum display.

kompressaur’s picture

A user currently sees sitewide forums and the og forums for groups that the user is subscribed too on the forum/ page. Hope that helps

Hi Paul i am using og forum 6.x-2.2. When i go to the /forum page of my site i am seeing the sitewide forums and also any forum that has been made public. All my forums are public by default so i am getting all the forums even for groups that a user hasnt joined. I'm sure it's just my lack of understandment. As a work around for now im just linking to the top container which contains my sitewide forums but it would be nice for users to visit /forum and see just what you said. that would work well. Would you have any idea where i could be going wrong?

thanks

jeffschuler’s picture

Version: 5.x-2.6 » 6.x-2.x-dev

I appreciate that a site with thousands of OG Forums incurs a serious performance hit when loading them all in the select. However, the current functionality seems very counter-intuitive to admins who -- on a site with, for example, 20 OG forums and no site-wide forums -- go to Create content > Forum topic and see no options in the Forums drop-down select, (and therefore cannot post by this method.)

I second the original request in this issue: to offer, in OG Forum's configuration, to show (or not) all forums to which the user has permission to post (and/or belongs to.)

vegantriathlete’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)