Add user::lookup_by_name()

This commit is contained in:
Bharat Mediratta
2009-04-18 23:06:38 +00:00
parent a3e8818449
commit 6b89e7fa2a

View File

@@ -281,6 +281,19 @@ class user_Core {
return null;
}
/**
* Look up a user by id.
* @param integer $id the user id
* @return User_Model the user object, or null if the id was invalid.
*/
static function lookup_by_name($name) {
$user = model_cache::get("user", $name, "name");
if ($user->loaded) {
return $user;
}
return null;
}
/**
* Create a hashed password using md5 plus salt.
* @param string $password plaintext password