I have a website where I have comments on certain content but I am not allowing any replies to these comments. When deleting a comment the confirm delete message shows as

'Any replies to this comment will be lost. This action cannot be undone.'

This is not ideal because obviously there will never be any replies.

I have found the function which creates the text for the message on line 257 of comment.admin.inc

function comment_confirm_delete($form, &$form_state, $comment) {
  $form['#comment'] = $comment;
  // Always provide entity id in the same form key as in the entity edit form.
  $form['cid'] = array('#type' => 'value', '#value' => $comment->cid);
  return confirm_form(
    t('Are you sure you want to delete the comment %title?', array('%title' => $comment->subject)),
    'node/' . $comment->nid,
    t('Any replies to this comment will be lost. This action cannot be undone.'),

How would I go about changing this text. Could I use template.php? If so how would I find the correct preprocess function. And then what is the way in which I could best find the variable in its current state in order to change it?

1 Answer 1


You can do this with hook_form_alter(). https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_form_alter/7

Just add an if statement to check if the $form_id is 'comment_confirm_delete', then you can alter anything in the $form object, including the text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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