diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-08 16:48:35 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-08 16:48:35 +0000 |
commit | 146062199ca57fdf34ff3a7acc603c63b644e290 (patch) | |
tree | d08b61e3aa64efe3d1702d9ee22f994c33fc0a05 /engine/lib/users.php | |
parent | 775885a82766bc733d7e9bbdd4bf4da7a8376c80 (diff) | |
download | elgg-146062199ca57fdf34ff3a7acc603c63b644e290.tar.gz elgg-146062199ca57fdf34ff3a7acc603c63b644e290.tar.bz2 |
Incorporating setup fixes from Rolando
git-svn-id: https://code.elgg.org/elgg/trunk@423 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r-- | engine/lib/users.php | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index cdd7f9a3d..68383d8e5 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -58,7 +58,7 @@ // Is $guid is a DB row - either a entity row, or a user table row.
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) + if (!$this->load($guid->guid))
throw new IOException("Failed to load new ElggUser from GUID:$guid->guid");
}
@@ -261,7 +261,7 @@ public function getCollections($subtype="", $limit = 10, $offset = 0) { return get_user_collections($this->getGUID(), $subtype, $limit, $offset); }
}
- +
/**
* Return the user specific details of a user by a row.
*
@@ -417,27 +417,28 @@ $ntt = get_entities('object',$subtype, $user_guid, "time_created desc", $limit, $offset);
return $ntt;
}
- - /** - * 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 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)
+ {
+ if (!empty($guid)) // Fixes "Exception thrown without stack frame" when db_select fails
+ $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
@@ -474,7 +475,7 @@ return new ElggUser($row);
return false;
- } + }
/**
* Registers a user, returning false if the username already exists
|