Somehow, someone decided that whenever creating a comment, whether you are the admin (or have administration rights for that), the Administration fieldset is not shown.

It is very annoying when you have to create a comment, then edit it to change the name of the author and the date. This may be rare, but there is no reason why that happens.

Thank you.
Alexis Wilke

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tectokronos’s picture

This issue is very old, but I wondered the same question and make this comment to another users wondering this too. I searched in the comment.module code, and this is because the module only shows the administration options if a cid exists (that is, if the comment is edited, not created).

It is possible to override this setting making an option to handle this.

Original code in comment.module:

1255  if ($user->uid) {
1256    if (!empty($edit['cid']) && user_access('administer comments')) {
1257      if (!empty($edit['author'])) {
1258        $author = $edit['author'];
1259      }
1260      elseif (!empty($edit['name'])) {
1261        $author = $edit['name'];
1262      }
1263    else {
1264        $author = $edit['registered_name'];
1265      }
1266
1267      if (!empty($edit['status'])) {
1268        $status = $edit['status'];
1269      }
1270      else {
1271        $status = 0;
1272     }
1273
1274      if (!empty($edit['date'])) {
1275       $date = $edit['date'];
1276      }
1277      else {
1278        $date = format_date($edit['timestamp'], 'custom', 'Y-m-d H:i O');
1279      }
1280
1281      $form['admin'] = array(
1282        '#type' => 'fieldset',
1283        '#title' => t('Administration'),
1284        '#collapsible' => TRUE,
1285       '#collapsed' => TRUE,
1286        '#weight' => -2,
1287      );
1288
1289      if ($edit['registered_name'] != '') {
1290        // The comment is by a registered user
1291        $form['admin']['author'] = array(
1292          '#type' => 'textfield',
1293          '#title' => t('Authored by'),
1294          '#size' => 30,
1295          '#maxlength' => 60,
1296          '#autocomplete_path' => 'user/autocomplete',
1297          '#default_value' => $author,
1298          '#weight' => -1,
1299        );
1300      }
1301      else {
1302        // The comment is by an anonymous user
1303        $form['is_anonymous'] = array(
1304          '#type' => 'value',
1305          '#value' => TRUE,
1306        );
1307        $form['admin']['name'] = array(
1308          '#type' => 'textfield',
1309          '#title' => t('Authored by'),
1310          '#size' => 30,
1311          '#maxlength' => 60,
1312          '#default_value' => $author,
1313          '#weight' => -1,
1314        );
1315        $form['admin']['mail'] = array(
1316          '#type' => 'textfield',
1317          '#title' => t('E-mail'),
1318          '#maxlength' => 64,
1319          '#size' => 30,
1320          '#default_value' => $edit['mail'],
1321          '#description' => t('The content of this field is kept private and will not be shown publicly.'),
1322        );
1323
1324        $form['admin']['homepage'] = array(
1325          '#type' => 'textfield',
1326          '#title' => t('Homepage'),
1327          '#maxlength' => 255,
1328          '#size' => 30,
1329          '#default_value' => $edit['homepage'],
1330        );
1331      }
1332
1333      $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);
1334
1335      $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' =>  $status, '#options' => array(t('Published'), t('Not published')), '#weight' => -1);
1336
1337    }
1338    else {
1339      $form['_author'] = array('#type' => 'item', '#title' => t('Your name'), '#value' => theme('username', $user)
1340      );
1341      $form['author'] = array('#type' => 'value', '#value' => $user->name);
1342    }
1343  }

Modified code to handle de administration settings on new comments:

1255  if ($user->uid) {
1256    if (!empty($edit['cid']) && user_access('administer comments')) {
1257      if (!empty($edit['author'])) {
1258        $author = $edit['author'];
1259      }
1260      elseif (!empty($edit['name'])) {
1261        $author = $edit['name'];
1262      }
1263    else {
1264        $author = $edit['registered_name'];
1265      }
1266
1267      if (!empty($edit['status'])) {
1268        $status = $edit['status'];
1269      }
1270      else {
1271        $status = 0;
1272     }
1273
1274      if (!empty($edit['date'])) {
1275       $date = $edit['date'];
1276      }
1277      else {
1278        $date = format_date($edit['timestamp'], 'custom', 'Y-m-d H:i O');
1279      }
1280
1281      $form['admin'] = array(
1282        '#type' => 'fieldset',
1283        '#title' => t('Administration'),
1284        '#collapsible' => TRUE,
1285       '#collapsed' => TRUE,
1286        '#weight' => -2,
1287      );
1288
1289      if ($edit['registered_name'] != '') {
1290        // The comment is by a registered user
1291        $form['admin']['author'] = array(
1292          '#type' => 'textfield',
1293          '#title' => t('Authored by'),
1294          '#size' => 30,
1295          '#maxlength' => 60,
1296          '#autocomplete_path' => 'user/autocomplete',
1297          '#default_value' => $author,
1298          '#weight' => -1,
1299        );
1300      }
1301      else {
1302        // The comment is by an anonymous user
1303        $form['is_anonymous'] = array(
1304          '#type' => 'value',
1305          '#value' => TRUE,
1306        );
1307        $form['admin']['name'] = array(
1308          '#type' => 'textfield',
1309          '#title' => t('Authored by'),
1310          '#size' => 30,
1311          '#maxlength' => 60,
1312          '#default_value' => $author,
1313          '#weight' => -1,
1314        );
1315        $form['admin']['mail'] = array(
1316          '#type' => 'textfield',
1317          '#title' => t('E-mail'),
1318          '#maxlength' => 64,
1319          '#size' => 30,
1320          '#default_value' => $edit['mail'],
1321          '#description' => t('The content of this field is kept private and will not be shown publicly.'),
1322        );
1323
1324        $form['admin']['homepage'] = array(
1325          '#type' => 'textfield',
1326          '#title' => t('Homepage'),
1327          '#maxlength' => 255,
1328          '#size' => 30,
1329          '#default_value' => $edit['homepage'],
1330        );
1331      }
1332
1333      $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);
1334
1335      $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' =>  $status, '#options' => array(t('Published'), t('Not published')), '#weight' => -1);
1336
1337    }
+         elseif (empty($edit['cid']) && user_access('administer comments')) {  // If the comment is new and the user has administer comments permission...
+           $form['admin'] = array(
+             '#type' => 'fieldset',
+             '#title' => t('Administration'),
+             '#collapsible' => TRUE,
+             '#collapsed' => FALSE,   // Change this to TRUE to show it collapsed.
+             '#weight' => -6,
+           );
+     
+           $form['admin']['author'] = array(
+             '#type' => 'textfield',
+             '#title' => t('Authored by'),
+             '#size' => 30,
+             '#maxlength' => 60,
+             '#autocomplete_path' => 'user/autocomplete',
+             '#default_value' => $user->name,  // Autopopulates the author with the username, but this can be changed.
+             '#description' => t('Leave blank for anonymous authored.'),
+             '#weight' => -6,
+           );
+
+           $date = format_date(time(), 'custom', 'Y-m-d H:i O');
+           $form['admin']['date'] = array('#type' => 'textfield', '#parents' => array('date'), '#title' => t('Authored on'), '#size' => 20, '#maxlength' => 25, '#default_value' => $date, '#weight' => -1);  // Autopopulates the date with the current date, but this can be changed.
+     
+           $form['admin']['status'] = array('#type' => 'radios', '#parents' => array('status'), '#title' => t('Status'), '#default_value' =>  COMMENT_PUBLISHED, '#options' => array(t('Published'), t('Not published')), '#weight' => 0);  // The comment will be published by default, but this can be changed. 
+     
+         }	
1338    else {
1339      $form['_author'] = array('#type' => 'item', '#title' => t('Your name'), '#value' => theme('username', $user)
1340      );
1341      $form['author'] = array('#type' => 'value', '#value' => $user->name);
1342    }
1343  }

This works for me, but use at your own risks. :D

AlexisWilke’s picture

Status: Active » Needs review
FileSize
2.05 KB

That works for me too.

There is one small glitch, when you click Preview and had the author field set to an empty string, it shows you as the author. I think that's the default behavior which is probably wrong. On Save it works though and we can easily explain to administrators how to ignore that problem.

Thank you for the patch! I'm attaching an actual .patch file 8-)
Alexis Wilke

andypost’s picture

Version: 6.x-dev » 8.x-dev
Category: Bug report » Task
Issue summary: View changes
Issue tags: +Usability

move to HEAD

andypost’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

borisson_’s picture

I can't reproduce this anymore, and I think we should close this issue.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Closed (outdated)
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.

Also was not able to replicate this per #10.

If still an issue please reopen with an updated issue summary please

Thanks!