You are here

function _forum_access_forum_overview in Forum Access 6

Same name and namespace in other branches
  1. 7 forum_access.admin.inc \_forum_access_forum_overview()

Remove unusable 'edit' links from overview form.

1 call to _forum_access_forum_overview()
forum_access_form_alter in ./forum_access.module
Implementation of hook_form_alter().

File

./forum_access.admin.inc, line 755
forum_access.admin.inc

Code

function _forum_access_forum_overview(&$form, &$form_state) {
  global $user;
  if ($user->uid == 1) {
    return;
  }
  foreach ($form as $key => $value) {
    if (preg_match('/^tid:(.*):0$/', $key, $matches)) {
      if (!forum_access_access($matches[1], 'view', NULL, FALSE)) {
        $form[$key]['edit']['#access'] = FALSE;
        if (preg_match('|<a [^>]*>([^<]*)</a>|', $form[$key]['view']['#value'], $matches)) {
          $form[$key]['view']['#value'] = $matches[1];
        }
      }
    }
  }
}