aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-17 15:48:35 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-17 15:48:35 +0000
commitf94edbcfc6edf1458c2608952929fba421fb3ac5 (patch)
treeeb64d59359d5d0bb8e34cf162f5cc5859d97d9a2 /engine/lib
parent6b3108197983f196f6fbbd95ec2809a4ff4105b1 (diff)
downloadelgg-f94edbcfc6edf1458c2608952929fba421fb3ac5.tar.gz
elgg-f94edbcfc6edf1458c2608952929fba421fb3ac5.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Some minor tweaks git-svn-id: https://code.elgg.org/elgg/trunk@235 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/sessions.php2
-rw-r--r--engine/lib/users.php23
2 files changed, 23 insertions, 2 deletions
diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php
index 62cf7e398..4b067da56 100644
--- a/engine/lib/sessions.php
+++ b/engine/lib/sessions.php
@@ -20,7 +20,7 @@
*/
function isloggedin() {
- if ($_SESSION['guid'] > 0)
+ if ((isset($_SESSION['guid'])) && ($_SESSION['guid'] > 0))
return true;
return false;
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