ENHANCEMENT: Added gravatar method to get the URL for the gravatar from the email address submitted with the comment

This commit is contained in:
Gordon Anderson 2013-03-06 15:50:41 +07:00
parent 652ddb938f
commit d4cc737878

View File

@ -394,4 +394,17 @@ class Comment extends DataObject {
$config->set('URI.DisableExternalResources', true);
return new HTMLPurifier($config);
}
/*
Calcualate the gravatar link from the email address
*/
public function Gravatar() {
$gravatar = '';
$use_gravatar = Commenting::get_config_value($this->BaseClass, 'use_gravatar');
if ($use_gravatar) {
$gravatar = "http://www.gravatar.com/avatar/" . md5( strtolower(trim($this->Email)));
}
return $gravatar;
}
}