mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-04 06:01:23 -04:00
Cleanup merge of user/group helpers into Identity interface. Reduce redundant code in the user module and remove references to the Identity helper from the user module as the user module should be able to access things directly. Simplify the get_user_list api method to just accept an array of ids to return user objects for.
This commit is contained in:
@@ -51,6 +51,16 @@ class User_Model extends ORM {
|
||||
module::event("user_deleted", $old);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a url to the user's avatar image.
|
||||
* @param integer $size the target size of the image (default 80px)
|
||||
* @return string a url
|
||||
*/
|
||||
public function avatar_url($size=80, $default=null) {
|
||||
return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg%s",
|
||||
md5($this->email), $size, $default ? "&d=" . urlencode($default) : "");
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->loaded) {
|
||||
$created = 1;
|
||||
@@ -63,4 +73,13 @@ class User_Model extends ORM {
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the best version of the user's name. Either their specified full name, or fall back
|
||||
* to the user name.
|
||||
* @return string
|
||||
*/
|
||||
public function display_name() {
|
||||
return empty($this->full_name) ? $this->name : $this->full_name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user