We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 7276478c authored by elleo's avatar elleo

Add gravatar support (default to monsterid if no gravatar is available)

parent ab330498
......@@ -38,7 +38,7 @@ class User {
/**
* User constructor
*
* @param string name The name of the artist to load
* @param string $name The name of the user to load
*/
function __construct($name) {
global $mdb2;
......@@ -60,7 +60,7 @@ class User {
/**
* Get a user's scrobbles ordered by time
*
* @param int number The number of scrobbles to return
* @param int $number The number of scrobbles to return
* @return An array of scrobbles
*/
function getScrobbles($number) {
......@@ -72,7 +72,17 @@ class User {
$i['timehuman'] = human_timestamp($i['time']);
}
return $data;
}
}
/**
* Retrieve a user's avatar via the gravatar service
*
* @param int $size The desired size of the avatar (between 1 and 512 pixels)
* @return A URL to the user's avatar image
*/
function getAvatar($size=64) {
return "http://www.gravatar.com/avatar/" . md5($this->email) . "?s=" . $size . "&d=monsterid";
}
}
......@@ -40,6 +40,7 @@ if(isset($user->name)) {
$smarty->assign('location', $user->location);
$smarty->assign('scrobbles', $user->getScrobbles(20));
$smarty->assign('userlevel', $user->userlevel);
$smarty->assign('avatar', $user->getAvatar());
$smarty->display('profile.tpl');
} else {
$smarty->assign('error', 'User not found');
......
......@@ -191,3 +191,7 @@ dl.gobbles {
color: #666;
font-size: .7em
}
h3 {
clear: left;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment