diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/sessions.php | 2 | ||||
-rw-r--r-- | engine/lib/users.php | 23 |
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
|