How to customize "Submitted by" text in Drupal 7

In Drupal 6, you could modify the theme function called theme_node_submitted. But this function has been removed in Drupal 7. This is how I customized the "Submitted by" text using Advanced Theming technique involving adding the theme_preprocess_node function.

Go to your sites/all/themes/yourthemename folder and open template.php in your code editor. Add this function to the end of your file. Remember to replace "theme" with yourthemename.

function theme_preprocess_node(&$vars) {

$vars['submitted'] =  t('Posted by !username on !datetime',
        array(
        '!username' => $vars['name'],
        '!datetime' => $vars['date'],
        ));
        
        }

Comments

This module do that too

You can also try the "Submitted by" module. Which is offer a lot of possibilites to customize the Submitted by information : http://drupal.org/project/submitted_by

Submitted_by module for Drupal 7 is in Dev stage

Thank you for your comment. I noticed that the Submitted by module for Drupal 7 is in Development and was last updated Nov. 2011. I hope the maintainers will update this module soon and release a more stable version.

I will be posting more examples of Advanced Theming techniques that involve adding functions to your template.php file. This is a very important skill that Drupal themers need to learn.