From 95a952861ec1d739dfde43ab6d08f466b2aacb0e Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 14 Apr 2011 00:03:32 +0000 Subject: Checking that get_user_by_username() returned something in ElggUser constructor to prevent notice (hellekin) git-svn-id: http://code.elgg.org/elgg/trunk@8987 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggUser.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'engine/classes/ElggUser.php') 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 -- cgit v1.2.3