With out this patch, anyone who can post to a non-group forum can also post to a group forum, even if not a member of that group.

With this patch if you attempt to post to a group forum of which you are not a member It will give you an error saying you must join the group before posting in the forum. It gives the user the option to immediately sign up to the group and continue posting his message if that is what the user wishes to do.

Comments

markDrupal’s picture

StatusFileSize
new549 bytes

You should also apply this patch, since the purpose of the previous patch is to allow guests to view the forums but stop them from posting. This patch removes the "Access denied" when a guest tries to view the group forums.

It creates a more open public group forum system.

side note: If you want to have a private message in the forums, you can use the OG audience select box and mark the post "Private" Then guests viewing the forums will not see any forum post marked "Private"

rconstantine’s picture

Whether groups forums can be seen by outsiders should be an option, and certainly not default. I'll be looking at these for inclusion in the next release.

rconstantine’s picture

Version: 5.x-1.3 » 5.x-2.x-dev
Assigned: Unassigned » rconstantine
Category: task » bug
Status: Needs review » Fixed

Mark, I changed how this was done. Rather than check after the user posts, I restrict the drop down by adding these lines:

    elseif ((arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum') && ($user->uid != 1)) {
      $restrict = TRUE;
    }

just after

function og_forum_db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid') {
  global $user;
  $restrict = FALSE;
  $restrict2 = FALSE;
  if ($primary_field == 'tid') {
    // Only do this on forum nodes
    if (((arg(0) == 'forum') || (arg(0) == 'og_forum') || (db_result(db_query('SELECT type FROM {node} WHERE nid = %d', arg(1))) == 'forum')) && ($user->uid != 1)) {
      $restrict = TRUE;
    }
    elseif ((arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'forum' && arg(3)) && ($user->uid != 1)) {   
      $restrict = TRUE;
      $restrict2 = TRUE;
    }

Seems to do the job. I'll upload the changes in a bit. I'd appreciate your opinion. For now I'm marking it as fixed.

rconstantine’s picture

By the way, I would like to address 'outsider viewabilty' of forums perhaps another way, starting with it being an admin option- probably at the group admin level rather than site-wide. Each group should determine whether outsiders can see what they're doing. Perhaps a global admin setting could allow/disallow this behavior, or even override/set this globally.

If you'd like to see this, please open a new feature request.

rconstantine’s picture

Status: Fixed » Closed (fixed)