Delete and edit comments on closed node

Node closed comment delete

Having a forum you needs quick deletions of improper comments.

In Drupal 7 and Drupal 8 you have to visit admin/content/comments to do so. But then you loose the thread.

You could review and use this patch or add this to your custom module. The first needs review and testing. The later needs a Drupal coder.

/**
 * Implements hook_entity_prepare_view().
 */
function module_custom_entity_prepare_view($entities, $type, $langcode) {
  // Store nodes to use with comments later on.
  static $nodes = array();

  if (user_access('administer comments')) {
    if ($type == 'node') {
      $nodes = $nodes + $entities;
    }
    elseif ($type == 'comment') {
      foreach ($entities as $cid => $comment) {
        if (isset($nodes[$comment->nid])) {
          $node = $nodes[$comment->nid];
          if ($node->comment == COMMENT_NODE_CLOSED) {
            $node->comment = COMMENT_NODE_OPEN;
          }
        }
      }
    }
  }
}