summaryrefslogtreecommitdiff
path: root/library/WT/Auth.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2014-10-05 21:22:20 +0100
committerGreg Roach <fisharebest@gmail.com>2014-10-05 21:22:20 +0100
commitd1ff1d3e61d18976df8ac9a8d428c32fa80c7a72 (patch)
treefa5ae41ff14229e9bcd9339c578d3ac35d0f4670 /library/WT/Auth.php
parentc5fa1f3610d9462cdd328f1cf9283598f001687c (diff)
downloadwebtrees-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.php13
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;
+ }
}
/**