From c4f1e4ba13905004fdcef814bdba949ec842ce6b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 22 Aug 2006 11:13:04 +0000 Subject: - Patch #76444 by chx, moshe, eaton, angie et al: make it possible to control access to form elements. --- modules/comment/comment.module | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 7aaed2fc7..4bb83df6c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -281,27 +281,20 @@ function comment_form_alter($form_id, &$form) { elseif (isset($form['type'])) { if ($form['type']['#value'] .'_node_form' == $form_id) { $node = $form['#node']; - if (user_access('administer comments')) { - $form['comment_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Comment settings'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#weight' => 30, - ); - $form['comment_settings']['comment'] = array( - '#type' => 'radios', - '#parents' => array('comment'), - '#default_value' => $node->comment, - '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), - ); - } - else { - $form['comment_settings']['comment'] = array( - '#type' => 'value', - '#value' => $node->comment, - ); - } + $form['comment_settings'] = array( + '#type' => 'fieldset', + '#access' => user_access('administer comments'), + '#title' => t('Comment settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#weight' => 30, + ); + $form['comment_settings']['comment'] = array( + '#type' => 'radios', + '#parents' => array('comment'), + '#default_value' => $node->comment, + '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')), + ); } } } -- cgit v1.2.3