How to remove (hide) "Submitted by" in Drupal

Submitted by str on Fri, 08/24/2012 - 23:04

In some of my sites, I don't want to include Submitted by in each post. Going to content type admin settings, I can disable that line entire line including the timestamp of posting, but that is not my requirement. I only want the author information to be remove or to hide.

Here's how I solve this case:

Edit node.module under modules/node directory. In Drupal 7.15, the section that you need to edit is in line 1469
vi +1469 node.module

You change below's code:
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['display_submitted'] = TRUE;
$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
$variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : '';
}
else {
$variables['display_submitted'] = FALSE;
$variables['submitted'] = '';
$variables['user_picture'] = '';
}

To something like this:
// Display post information only on certain node types.
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$variables['display_submitted'] = TRUE;
$variables['submitted'] = t('!datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
$variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : '';
}
else {
$variables['display_submitted'] = FALSE;
$variables['submitted'] = '';
$variables['user_picture'] = '';
}

Related Items