As supplied by the core comment module when you go to edit a comment as an admin there is an Administration fieldset that lets you change the author and if the comment is published. When you load the page the fieldset is collapse and I'd like it to be open by default.

I found in the comments.module this bit of code:

// Display author information in a fieldset for comment moderators.
if ($is_admin) {
$form['author'] = array(
  '#type' => 'fieldset',
  '#title' => t('Administration'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#weight' => -2,

Is there a hook or something I could use to manipulate this?


Use hook_form_alter(). Here's an example:

    function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id) {
      if ($form_id == 'comment_node_YOUR_CONTENT_TYPE_form') {
        $form['author']['#collapsed'] = FALSE;

You can place this in a custom module, or in template.php of your your front end theme.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.