How to change the default theme of comment_submitted in drupal?


$variables['submitted'] = theme('comment_submitted', $comment);


enter image description here

My expected result is

  • To print the Name in first and time in second.

  • Should not truncate.

How can this be done?

2 Answers 2


Add a function in your template.php located in your theme's directory.

function phptemplate_comment_submitted($comment){
  return t('Submitted on @datetime by !username.',
      '!username' => theme('username', $comment),
      '@datetime' => format_date($comment->timestamp)

You can override any theme function implementing hook_theme_registry_alter() in a module.

function mymodule_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['comment_submitted'])) {
    $theme_registry['comment_submitted']['function'] = 'theme_mymodule_comment_submitted';

In this case, as what you want is to override a string used by a module, String Overrides could help you. You just need to replace "Submitted by !username on @datetime." with "Submitted on @datetime by !username."

Your Answer

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

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