summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-04-18 23:06:38 +0000
committerBharat Mediratta <bharat@menalto.com>2009-04-18 23:06:38 +0000
commit6b89e7fa2a32ad4e8013c32db625df50db1bbc39 (patch)
treea85a5e504f93642aa2bcf1c15f725be532c6b05a
parenta3e8818449677d08444cd30613603440e6529c5a (diff)
Add user::lookup_by_name()
-rw-r--r--modules/user/helpers/user.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php
index 527db145..30b95099 100644
--- a/modules/user/helpers/user.php
+++ b/modules/user/helpers/user.php
@@ -282,6 +282,19 @@ class user_Core {
}
/**
+ * 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
* @param string $salt (optional) salt or hash containing salt (randomly generated if omitted)