? user_badges-986822.patch Index: user_badges.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/user_badges/user_badges.module,v retrieving revision 1.15.2.20 diff -u -p -r1.15.2.20 user_badges.module --- user_badges.module 18 Oct 2010 19:25:24 -0000 1.15.2.20 +++ user_badges.module 2 Dec 2010 03:23:00 -0000 @@ -211,14 +211,16 @@ function user_badges_user($op, &$edit, & //Set to -1 for no limit $limit = -1; } - //Loop through all potential badges and get the ones we can show - foreach ($account->badges_all as $bid => $badge) { - //Display the badge if there's no limit or if the badge is unhideable or if we are within our limit - if ( $limit != 0 || $badge->unhideable == 1 ) { - $account->badges[$bid] = $badge; - //Count down our limit, unless the badge doesn't count towards it - if (!$badge->doesnotcounttolimit) { - $limit--; + // Loop through all potential badges and get the ones we can show. + if (!empty($account->badges_all)) { + foreach ($account->badges_all as $bid => $badge) { + //Display the badge if there's no limit or if the badge is unhideable or if we are within our limit + if ( $limit != 0 || $badge->unhideable == 1 ) { + $account->badges[$bid] = $badge; + //Count down our limit, unless the badge doesn't count towards it + if (!$badge->doesnotcounttolimit) { + $limit--; + } } } } @@ -227,7 +229,9 @@ function user_badges_user($op, &$edit, & $account->badges = $account->badges_all; } } - $badges[$account->uid] = $account->badges; + if (isset($account->badges)) { + $badges[$account->uid] = $account->badges; + } break; case 'insert': @@ -825,7 +829,12 @@ function user_badges_get_badges($uid, $o } } - return $badges[$uid]; + if (isset($badges[$uid])) { + return $badges[$uid]; + } + else { + return FALSE; + } } @@ -1024,7 +1033,7 @@ function theme_user_badge($badge, $accou $image = theme('imagecache', 'user-badges', $badge->image, $badge->name, $badge->name, array('class' => $badge->class)); } else { - $image = theme('image', $badge->image, $badge->name, $badge->name, array('class' => $badge->class), !get_size); + $image = theme('image', $badge->image, $badge->name, $badge->name, array('class' => empty($badge->class) ? '' : $badge->class), !$get_size); } //We don't link the badge if there is no link and no default, or if the default is overridden