You are here

function forum_access_menu_alter in Forum Access 6

Same name and namespace in other branches
  1. 7 forum_access.module \forum_access_menu_alter()

Implementation of hook_menu_alter().

Remove the 'Forum' menu item if no forums are visible.

File

./forum_access.module, line 590
forum_access.module

Code

function forum_access_menu_alter(&$items) {
  if (!empty($items['forum'])) {

    //dpm($items['forum'], 'hook_menu_alter($items[\'forum\'])');
    if (!empty($items['forum']['access callback']) || $items['forum']['access arguments'][0] != 'access content') {
      drupal_set_message(t('Unexpected access specification for the %forum menu path; @Forum_Access cannot control its access.', array(
        '%forum' => 'forum',
        '@Forum_Access' => 'Forum Access',
      )), 'error');
      return;
    }
    $items['forum']['access callback'] = '_forum_access_forum_access_callback';
    $items['forum']['access arguments'] = array(
      1,
    );
  }
}