User::get_avatar_html()
This commit is contained in:
parent
9695c6b45b
commit
6ed28c8a43
1 changed files with 13 additions and 0 deletions
|
@ -124,5 +124,18 @@ class User {
|
|||
$database->Execute("UPDATE users SET email=? WHERE id=?", array($address, $this->id));
|
||||
log_info("core-user", "Set email for {$this->name}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a snippet of HTML which will render the user's avatar, be that
|
||||
* a local file, a remote file, a gravatar, a something else, etc
|
||||
*/
|
||||
public function get_avatar_html() {
|
||||
// FIXME: configurable
|
||||
if(!empty($this->email)) {
|
||||
$hash = md5(strtolower($this->email));
|
||||
return "<img src=\"http://www.gravatar.com/avatar/$hash.jpg\">";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Reference in a new issue