You are here

function forum_access_preprocess_forums in Forum Access 6

Implementation of $modulename_preprocess_$hook() for forums.

Remove 'post' links from forum page, if the user does not have the 'create' permission.

File

./forum_access.module, line 371
forum_access.module

Code

function forum_access_preprocess_forums(&$variables) {
  if (!forum_access_access($variables['tid'], 'create') && !empty($variables['links'])) {
    foreach ($variables['links'] as $key => $link) {
      if (isset($link['href']) && substr($link['href'], 0, 9) == 'node/add/') {
        unset($variables['links'][$key]);
      }
    }
  }
}