Fix for Code

  1. function anbient_theme_username($object) {
  2.        
  3.        
  4.         $papell = $object->role;
  5.         switch ($papell) {
  6.     case "administrador":
  7.         $papel = '!';
  8.         break;
  9.     case "uploader":
  10.         $papel = '#';
  11.         break;
  12.     case "power user":
  13.         $papel = '+';
  14.         break;
  15.         case "moderador":
  16.                 $papel = '@';
  17. }
  18.  
  19.  
  20.  
  21.  
  22.   if ($object->uid && $object->name) {
  23.     // Shorten the name when it is too long or it will break many tables.      
  24.        
  25.     if (drupal_strlen($object->name) > 20) {
  26.       $name = drupal_substr($papel.$object->name, 0, 15) .'...';
  27.     }
  28.     else {
  29.       $name = '######'.$papel.$object->name;
  30.     }
  31.  
  32.     if (user_access('access user profiles')) {
  33.       $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
  34.     }
  35.     else {
  36.       $output = check_plain($name);
  37.     }
  38.   }
  39.   else if ($object->name) {
  40.     // Sometimes modules display content composed by people who are
  41.     // not registered members of the site (e.g. mailing list or news
  42.     // aggregator modules). This clause enables modules to display
  43.     // the true author of the content.
  44.     if (!empty($object->homepage)) {
  45.       $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
  46.     }
  47.     else {
  48.       $output = check_plain($object->name);
  49.     }
  50.  
  51.     $output .= ' ('. t('not verified') .')';
  52.   }
  53.   else {
  54.     $output = check_plain(variable_get('anonymous', t('Anonymous')));
  55.   }
  56.  
  57.   return $output;
  58. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.