From: Alexander Ebert Date: Tue, 9 Apr 2024 14:21:18 +0000 (+0200) Subject: Allow the registration date to be open-ended X-Git-Tag: 6.0.12_dev_1~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d5024cf6270b0940ddaf96c2aca57987ced1580;p=GitHub%2FWoltLab%2FWCF.git Allow the registration date to be open-ended See https://www.woltlab.com/community/thread/305650/ --- diff --git a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php index 3d0cfefafe..ed2eeae471 100644 --- a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php @@ -82,28 +82,34 @@ class UserRegistrationDateCondition extends AbstractSingleFieldCondition impleme public function checkUser(Condition $condition, User $user) { /** @noinspection PhpUndefinedFieldInspection */ - $registrationDateStart = \DateTime::createFromFormat( - 'Y-m-d', - $condition->registrationDateStart, - new \DateTimeZone(TIMEZONE) - ); - if ($registrationDateStart !== false) { - $registrationDateStart->setTime(0, 0, 0); - if ($user->registrationDate < $registrationDateStart->getTimestamp()) { - return false; + $dateStart = $condition->registrationDateStart; + if ($dateStart !== null) { + $registrationDateStart = \DateTime::createFromFormat( + 'Y-m-d', + $dateStart, + new \DateTimeZone(TIMEZONE) + ); + if ($registrationDateStart !== false) { + $registrationDateStart->setTime(0, 0, 0); + if ($user->registrationDate < $registrationDateStart->getTimestamp()) { + return false; + } } } /** @noinspection PhpUndefinedFieldInspection */ - $registrationDateEnd = \DateTime::createFromFormat( - 'Y-m-d', - $condition->registrationDateEnd, - new \DateTimeZone(TIMEZONE) - ); - if ($registrationDateEnd !== false) { - $registrationDateEnd->setTime(23, 59, 59); - if ($user->registrationDate >= $registrationDateEnd->getTimestamp()) { - return false; + $dateEnd = $condition->registrationDateEnd; + if ($dateEnd !== null) { + $registrationDateEnd = \DateTime::createFromFormat( + 'Y-m-d', + $dateEnd, + new \DateTimeZone(TIMEZONE) + ); + if ($registrationDateEnd !== false) { + $registrationDateEnd->setTime(23, 59, 59); + if ($user->registrationDate >= $registrationDateEnd->getTimestamp()) { + return false; + } } }