From f94edbcfc6edf1458c2608952929fba421fb3ac5 Mon Sep 17 00:00:00 2001 From: icewing Date: Mon, 17 Mar 2008 15:48:35 +0000 Subject: Marcus Povey * Some minor tweaks git-svn-id: https://code.elgg.org/elgg/trunk@235 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/users.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'engine/lib/users.php') diff --git a/engine/lib/users.php b/engine/lib/users.php index 02a7773dd..205c7c66c 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -251,7 +251,7 @@ public function getCollections($subtype="", $limit = 10, $offset = 0) { get_user_collections($this->getGUID(), $subtype, $limit, $offset); } } - + /** * Return the user specific details of a user by a row. * @@ -406,6 +406,27 @@ function get_user_objects($user_guid, $subtype = "", $limit = 10, $offset = 0) { return get_entities('object',$subtype, $user_guid, "time_created desc", $limit, $offset); } + + /** + * Get a user object from a GUID. + * + * This function returns an ElggUser from a given GUID. + * @param int $guid The GUID + * @return ElggUser|false + * @throws InvalidParameterException if $GUID exists but is not an ElggUser. + */ + function get_user($guid) + { + $result = get_entity($guid); + + if (($result) && (!($result instanceof ElggUser))) + throw new InvalidParameterException("GUID:$guid is not an ElggUser"); + + if ($result) + return $result; + + return false; + } /** * Get user by username -- cgit v1.2.3