Hi y'all,

I'm pretty new to Drupal, but not really new in the website world. I made websites in Joomla, Wordpress, phpBB and made an own CMS. But was done with all the crappy CMS and don't want to put a lot of time and afford in my own CMS to keep it up to date so I switched to Drupal.

I've the module "User Badges" and I want to see the badge under the name on each comment (on pages,blogs or forum) or under the name from posting an article and so on. But I can't figure out how.

I tried to paste this code in the user-picture.tpl.php but I see only the avatar and not the badges.

<?php
  if (module_exists('user_badges')) {
    print user_badges_for_uid($uid);
  }
?>

Please help

Thanks in advice

Comments

jaypan’s picture

$uid probably isn't set. Try the following:

  global $user;
  if (module_exists('user_badges')) {
    print user_badges_for_uid($user->uid);
  }

Contact me to contract me for D7 -> D10/11 migrations.

MarkRaats’s picture

That works, thanks for the quick response!