From c6896f91c0d23adebd734a981e56898ceed64d48 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Sun, 17 Dec 2023 13:08:29 +0100 Subject: [PATCH] fix: #108 channel redirection --- src/classes/wishthis/User.php | 4 ++-- src/functions/redirect.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 ) {