--- advanced_forum.module 2009-01-28 00:31:12.000000000 +0100 +++ advanced_forum.module 2009-02-06 19:08:13.062500000 +0100 @@ -12,8 +12,11 @@ * Implementation of hook_perm(). */ function advanced_forum_perm() { - return array('administer advanced forum', - 'view forum statistics'); + return array( + 'administer advanced forum', + 'view forum statistics', + 'view forum selector', + ); } /** @@ -144,6 +147,31 @@ function advanced_forum_theme_registry_a } } +/** + * Implementation of hook_form_alter(). + */ +function advanced_forum_form_alter(&$form, $form_state, $form_id) { + // if forum id is passed as last arg, then hide the forum selector on the input form + $forumid = end(arg()); + $forum = forum_term_load($forumid); + + if ($forum && $form_id == 'forum_node_form' && !user_access('view forum selector')){ + $form['taxonomy'][1] = array( + '#type' => 'hidden', + '#default_value' => $forumid, + ); + } + + // if editing a forum node, and they don't have the relevant permissions to see the forum selector, + // then hide it away from them + if (arg(2) == 'edit' && $form_id == 'forum_node_form' && !user_access('view forum selector')){ + $form['taxonomy'][1] = array( + '#type' => 'hidden', + '#default_value' => $form['forum_tid'], + ); + } +} + // SETTINGS PAGE *************************************************************/ /**