If you have a lot of current avatarless members, you may want to go back and load gravatars for them to make your site and especially the comments threads a bit more colorful/personalized. To do that, copy this script to a text file and save it as loadgravatars.php:
<?php
require 'start.php';
if (!$start) $start = 0;
if (!$perpage) $perpage = 50;
$q = $db->select('all', 'memberstable', "1=1", "ORDER BY id DESC", "LIMIT $start,$perpage");
$n = $db->numrows($q);
for($x=0;$x<$n;$x++)
{
$m = new member('row', $db->row($q));
if ($m->avatarname == '' && $m->email != '')
{
$filename = md5(strtolower(trim($m->email))).'.png';
$gravatarurl = "http://www.gravatar.com/avatar/".$filename;
$checkurl = $gravatarurl.'?d=404';
$test = urlheaders($checkurl);
$exists = true;
foreach($test as $t) { if (strstr($t, '404 Not Found')) $exists = false; }
if ($exists)
{
$m->avatarname = uploadurl($gravatarurl, $filename, false, 'avatars');
$m->update('avatarname');
$msg .= 'Added gravatar for '.$m->profileurl().'...';
}
}
}
$start += $perpage;
if ($n) indirectredirect($msg." Continuing to next batch...", "loadgravatars.php?start=$start");
else die("Done!");
require 'end.php';
?>
Upload that to your WSN installation's main directory and visit it in your web browser to start loading gravatars.