Skip to content

Instantly share code, notes, and snippets.

@massiws
Last active March 26, 2017 01:47
Show Gist options
  • Save massiws/de1b2b0bf0b6994468ee6ead9bf5eb9a to your computer and use it in GitHub Desktop.
Save massiws/de1b2b0bf0b6994468ee6ead9bf5eb9a to your computer and use it in GitHub Desktop.
Drupal 7: display username in user-menu block title
<?php
/**
* Implements MY_THEME_preprocess_block().
*/
function MY_THEME_preprocess_block(&$variables) {
global $user;
$block =& $variables['block'];
if ($block->module == 'system' && $block->delta == 'user-menu' && user_is_logged_in()) {
$block->subject = check_plain($user->name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment