Reload user object
authorCyperghost <olaf_schmitz_1@t-online.de>
Mon, 6 May 2024 10:33:13 +0000 (12:33 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Mon, 6 May 2024 10:33:13 +0000 (12:33 +0200)
User should not have a pending activation

wcfsetup/install/files/lib/form/RegisterActivationForm.class.php
wcfsetup/install/files/lib/system/user/command/RegistrationNotification.class.php

index eac11e35b9eebf41b71fb31e6d8e9caa1d5aeafd..3d3ef7eed4b3c99af5e3746ea20534d591d014bc 100644 (file)
@@ -147,7 +147,8 @@ final class RegisterActivationForm extends AbstractFormBuilderForm
             $redirectText = WCF::getLanguage()->getDynamicVariable('wcf.user.registerActivation.success');
         }
 
-        $command = new RegistrationNotification($this->user);
+        // User must be reloaded to get the correct activation status.
+        $command = new RegistrationNotification(new User($this->user->userID));
         $command();
 
         HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), $redirectText, 10, 'success', true);
index 3a2e8f8dcbdd4742e5fd2be770764404cd9ccbcd..7ba63f8d8b117052a5ccef09dc05c7bd205657bc 100644 (file)
@@ -23,7 +23,7 @@ final class RegistrationNotification
 
     public function __invoke(): void
     {
-        if (!$this->user->requiresAdminActivation() && !$this->user->pendingActivation()) {
+        if ($this->user->pendingActivation() && !$this->user->requiresAdminActivation()) {
             return;
         }