aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggUser.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php
index 5c65a4d66..1af4cdc3a 100644
--- a/engine/classes/ElggUser.php
+++ b/engine/classes/ElggUser.php
@@ -59,9 +59,11 @@ class ElggUser extends ElggEntity
// See if this is a username
} else if (is_string($guid)) {
- $guid = get_user_by_username($guid);
- foreach ($guid->attributes as $key => $value) {
- $this->attributes[$key] = $value;
+ $user = get_user_by_username($guid);
+ if ($user) {
+ foreach ($user->attributes as $key => $value) {
+ $this->attributes[$key] = $value;
+ }
}
// Is $guid is an ElggUser? Use a copy constructor