If you force the avatars to be square, then the aspect ratio of the images won't be preserved, and you will wind up with "squished" images. However, give this a try, and you'll see what I mean:
PHP Code:
global $vbulletin, $db;
$max = 5;
$output = '<div class="restore">';
$rep_users = $vbulletin->db->query_read("
SELECT user.*
FROM " . TABLE_PREFIX . "user AS user
WHERE options & 1024
AND usergroupid NOT IN (6,8)
ORDER BY reputation DESC
");
$rcount = 0;
while ($rep_user = $db->fetch_array($rep_users) AND $rcount < $max)
{
$avatar_url = fetch_avatar_url($rep_user['userid']);
$avatar = $avatar_url[0];
if (!$avatar)
{
$avatar = $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';
}
$output .= '<div style="margin: 5px 0;"><img src="' . $avatar . '" style="vertical-align: middle; width: 40px; height: 40px; margin-right: 0.25em" />' . repuser_link($rep_user) . ': ' . $rep_user['reputation'] . ' Points</div>';
$rcount++;
}
$output .= '</div>';
return $output;
function repuser_link($user)
{
global $vbulletin;
$link = 'member.php?do=getinfo&username=' . $user['username'];
if ($user['displaygroupid'])
{
$groupid = $user['displaygroupid'];
}
else
{
$groupid = $user['usergroupid'];
}
$open_tag = $vbulletin->usergroupcache[$groupid]['opentag'];
$close_tag = $vbulletin->usergroupcache[$groupid]['closetag'];
$title = 'Visit ' . $user['username'] . '\'s Profile';
return '<a title="' . $title . '" href="' . $link . '">' . $open_tag . $user['username'] . $close_tag . '</a>';
}