Custom "Logged in as [USERNAME]" block

Public

</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_block_info().
  3.  */
  4. function mymodule_block_info() {
  5. return array(
  6. 'mymodule_logged_in_as' => array(
  7. 'info' => t('Login information ("Logged in as...").'),
  8. 'cache' => DRUPAL_CACHE_PER_USER,
  9. ),
  10. );
  11. }
  12.  
  13. /**
  14.  * Implements hook_block_view().
  15.  */
  16. function mymodule_block_view($delta = '') {
  17. if ($delta == 'mymodule_logged_in_as') {
  18. global $user;
  19. return array(
  20. 'subject' => NULL,
  21. 'content' => t('Logged in as !name', array('!name' => theme('username', array('account' => $user)))),
  22. );
  23. }
  24. }