Remove username from recent content block Drupal 7
I'm using Drup开发者_StackOverflow中文版al 7 and Garland theme. The Recent Content block is currently displaying the name of the title of the node recently modified plus the username of the corresponding user.
I would like to remove the username from display. I won't accept solutions which use the Views module.
Thanks a lot!
You need to modify the Garland theme so it doesn't show user name as part of that block. You can do so directly in the Garland theme by adding the following code to the end of /themes/garland/template.php:
/**
* Returns HTML for a recent node to be displayed in the recent content block.
*
* @param $variables
* An associative array containing:
* - node: A node object.
*
* @ingroup themeable
*/
function garland_node_recent_content($variables) {
$node = $variables['node'];
$output = '<div class="node-title">';
$output .= l($node->title, 'node/' . $node->nid);
$output .= theme('mark', array('type' => node_mark($node->nid, $node->changed)));
$output .= '</div>';
return $output;
}
Simply save and then clear all of your caches (under Admin|Performance).
However, I would suggest you create a copy of the Garland theme and create a new theme under /sites/all/themes/. Then you modify the template.php there. This is so if you upgrade you don't bonk your changes (since Garland is part of Drupal core).
精彩评论