2

How to change the default theme of comment_submitted in drupal?

Input:

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

Output

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

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.',
    array(
      '!username' => theme('username', $comment),
      '@datetime' => format_date($comment->timestamp)
    ));
}
0
1

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, privacy policy and cookie policy

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