diff --git a/src/classes/wishthis/User.php b/src/classes/wishthis/User.php index bd5b1a10..6ec2fb58 100644 --- a/src/classes/wishthis/User.php +++ b/src/classes/wishthis/User.php @@ -530,9 +530,9 @@ class User $this->birthdate = $birthdate; } - public function getChannel(): string + public function getChannel(): string|null { - return $this->channel; + return $this->channel ?? null; } public function setChannel(string $channel): void diff --git a/src/functions/redirect.php b/src/functions/redirect.php index 70886604..0809f1d3 100644 --- a/src/functions/redirect.php +++ b/src/functions/redirect.php @@ -32,14 +32,14 @@ function redirect(string $target) if ( defined('CHANNELS') && is_array(CHANNELS) - && isset($user->channel) + && $user->getChannel() && !$isDevEnvironment ) { $host = null; foreach (CHANNELS as $channel) { if ( - $channel['branch'] === $user->channel + $channel['branch'] === $user->getChannel() && $channel['host'] !== $_SERVER['HTTP_HOST'] && $isHostInChannel ) {