diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-15 14:30:41 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-15 14:30:41 +0000 |
commit | 31f8c77e0faea5b6ac7c9d37830a77be575676d4 (patch) | |
tree | 3d7b6fef9ad04518a23c9536534a8b917990575d /engine/lib/users.php | |
parent | 0fa665c8f465f2d3b85cb093d05f4d991516ca05 (diff) | |
download | elgg-31f8c77e0faea5b6ac7c9d37830a77be575676d4.tar.gz elgg-31f8c77e0faea5b6ac7c9d37830a77be575676d4.tar.bz2 |
Session functionality, hello again!
git-svn-id: https://code.elgg.org/elgg/trunk@233 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r-- | engine/lib/users.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index 8af060575..02a7773dd 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -406,5 +406,42 @@ function get_user_objects($user_guid, $subtype = "", $limit = 10, $offset = 0) {
return get_entities('object',$subtype, $user_guid, "time_created desc", $limit, $offset);
}
+
+ /**
+ * Get user by username
+ *
+ * @param string $username The user's username
+ * @return ElggUser|false Depending on success
+ */
+ function get_user_by_username($username)
+ {
+ global $CONFIG;
+ $username = sanitise_string($username);
+ $row = get_data_row("SELECT * from {$CONFIG->dbprefix}users_entity where username='$username'");
+
+ if ($row)
+ return new ElggUser($row);
+
+ return false;
+ }
+
+ /**
+ * Get user by session code
+ *
+ * @param string $code The session code
+ * @return ElggUser|false Depending on success
+ */
+ function get_user_by_code($code)
+ {
+ global $CONFIG;
+
+ $code = sanitise_string($code);
+ $row = get_data_row("SELECT * from {$CONFIG->dbprefix}users_entity where code='$code'");
+
+ if ($row)
+ return new ElggUser($row);
+
+ return false;
+ }
?>
\ No newline at end of file |