diff options
| author | Greg Roach <fisharebest@gmail.com> | 2014-10-05 21:22:20 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2014-10-05 21:22:20 +0100 |
| commit | d1ff1d3e61d18976df8ac9a8d428c32fa80c7a72 (patch) | |
| tree | fa5ae41ff14229e9bcd9339c578d3ac35d0f4670 /library/WT/Auth.php | |
| parent | c5fa1f3610d9462cdd328f1cf9283598f001687c (diff) | |
| download | webtrees-d1ff1d3e61d18976df8ac9a8d428c32fa80c7a72.tar.gz webtrees-d1ff1d3e61d18976df8ac9a8d428c32fa80c7a72.tar.bz2 webtrees-d1ff1d3e61d18976df8ac9a8d428c32fa80c7a72.zip | |
Visitors have a null 'User' object
Diffstat (limited to 'library/WT/Auth.php')
| -rw-r--r-- | library/WT/Auth.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/library/WT/Auth.php b/library/WT/Auth.php index 066cc1dbfa..b87df4fd52 100644 --- a/library/WT/Auth.php +++ b/library/WT/Auth.php @@ -155,7 +155,18 @@ class Auth { * @return User|null */ public static function user() { - return User::find(Auth::id()); + $user = User::find(Auth::id()); + if ($user === null) { + $visitor = new \stdClass; + $visitor->user_id = ''; + $visitor->user_name = ''; + $visitor->real_name = ''; + $visitor->email = ''; + + return new User($visitor); + } else { + return $user; + } } /** |
