We are developing an online community with forums which need to be private (only accessed by the members of the community). Unfortunately, the forum.module for drupal allows anyone with ‘access content’ privileges to access the forums. Obviously, we want visitors to be able to view the pages and almost all other content, but we want the forums to be private.
There is a module called Forum Access, which enables great control over forum access, but if used to disable access for visitors and other roles, these users will still see a Forum menu item, and if they click on it they will see a “No Forums Defined” message. This will undoubtedly give some people the wrong picture.
With 2 simple edits to the forum.module file, we enabled the exact functionality we were looking for: Control Forum Display using Access Roles, and Hide the Forums for those not authorized.
On line 41 of the forum.module file:
‘access’ => user_access(‘access forums’), //changed from ‘access content’ to ‘access forums’ <- Our own defined permissionOn line 131 of the forum.module file:
return array(‘create forum topics’, ‘edit own forum topics’, ‘administer forums’, ‘access forums’); //added ‘access forums’ permission
Now all we have to do is go to: Administer >> User management >> Access control, and select the checkbox next to ‘access forums’ (under forum module) for each of the roles that we want to give forum access to.