I would like to overwrite a default message for posting a comment.
For example, I would like to display “Your comment has been sent to the site moderator and will remain private.” instead of “Your comment has been queued for review by site administrators and will be published after approval.“
I tried hook insert, but it didn’t override the message:
function custom_comment_insert($comment) {
//drupal_get_messages(null, true);
unset($_SESSION['messages']);
drupal_set_message(t('override like this.'));
}
Don’t use that, use String Overrides to change the message instead. In general, if you want to reword text, don’t hack it, override it.
In Drupal 7, you can use
settings.phpto change it directly: (See http://preprocess.me/drupal-override-strings-in-settingsphp)