account_sentinel.themes.inc 764 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @file
  4. * Contains Account Sentinel's templates and template preprocessors.
  5. */
  6. /**
  7. * Formats a username by its UID.
  8. *
  9. * Almost the same as the "username" theme, but if the UID is not 0 and
  10. * user_load returns FALSE, it will return the UID of the (probably) deleted
  11. * user.
  12. *
  13. * @param array $variables
  14. * An associative array containing:
  15. * - uid: The UID of the user.
  16. *
  17. * @see theme_username()
  18. *
  19. * @return string
  20. * The HTML for a username.
  21. */
  22. function theme_account_sentinel_username(array $variables) {
  23. $uid = $variables['uid'];
  24. $user = user_load($uid);
  25. if ($uid != 0 && $user === FALSE) {
  26. return t('#@uid (deleted)', array('@uid' => $uid));
  27. }
  28. else {
  29. return theme('username', array('account' => $user));
  30. }
  31. }