{if $__wcf->session->getPermission('admin.user.canDisableAvatar')}<li><a href="#" class="jsButtonUserDisableAvatar">{lang}wcf.user.{if $user->disableAvatar}enable{else}disable{/if}Avatar{/lang}</a></li>{/if}
{if $__wcf->session->getPermission('admin.user.canDisableSignature')}<li><a href="#" class="jsButtonUserDisableSignature">{lang}wcf.user.{if $user->disableSignature}enable{else}disable{/if}Signature{/lang}</a></li>{/if}
{if MODULE_USER_COVER_PHOTO && $__wcf->session->getPermission('admin.user.canDisableCoverPhoto')}<li><a href="#" class="jsButtonUserDisableCoverPhoto">{lang}wcf.user.{if $user->disableCoverPhoto}enable{else}disable{/if}CoverPhoto{/lang}</a></li>{/if}
- {if $__wcf->session->getPermission('admin.user.canEnableUser')}<li><a href="#" class="jsButtonUserEnable">{lang}wcf.acp.user.{if $user->isActivated()}enable{else}disable{/if}{/lang}</a></li>{/if}
+ {if $__wcf->session->getPermission('admin.user.canEnableUser')}<li><a href="#" class="jsButtonUserEnable">{lang}wcf.acp.user.{if $user->pendingActivation()}disable{else}enable{/if}{/lang}</a></li>{/if}
{if $__wcf->session->getPermission('admin.general.canUseAcp') && $__wcf->session->getPermission('admin.user.canEditUser')}<li><a href="{link controller='UserEdit' object=$user isACP=true}{/link}" class="jsUserInlineEditor">{lang}wcf.user.edit{/lang}</a></li>{/if}
{/if}
<p class="info" role="status">{lang}wcf.page.availableUpdates{/lang}</p>
{/if}
- {* user needs email confirmation to be activated *}
- {if !$__wcf->user->isEmailConfirmed() && !$__wcf->user->isActivated() && REGISTER_ACTIVATION_METHOD & 1 && $templateName != 'registerActivation' && $templateName != 'register' && $templateName != 'redirect' && $__wcf->user->getBlacklistMatches()|empty}
- <p class="warning" role="status">{lang}wcf.user.register.needActivation{/lang}</p>
- {/if}
-
- {* user needs admin activation *}
- {if $__wcf->user->isEmailConfirmed() && REGISTER_ACTIVATION_METHOD & 2 && !$__wcf->user->isActivated() && $templateName != 'registerActivation' && $templateName != 'register' && $templateName != 'redirect' && $__wcf->user->getBlacklistMatches()|empty}
- <p class="warning" role="status">{lang}wcf.user.register.needAdminActivation{/lang}</p>
- {/if}
-
- {* user needs email activation w/o being disabled *}
- {if !$__wcf->user->isEmailConfirmed() && REGISTER_ACTIVATION_METHOD & 1 && $__wcf->user->isActivated() && $templateName != 'registerActivation' && $templateName != 'register' && $templateName != 'redirect' && $__wcf->user->getBlacklistMatches()|empty}
- <p class="warning" role="status">{lang}wcf.user.register.needEmailConfirmation{/lang}</p>
+ {if $templateName != 'registerActivation' && $templateName != 'register' && $templateName != 'redirect' && $__wcf->user->getBlacklistMatches()|empty}
+ {if $__wcf->user->requiresEmailActivation()}
+ <p class="warning" role="status">{lang}wcf.user.register.needActivation{/lang}</p>
+ {elseif $__wcf->user->requiresAdminActivation()}
+ <p class="warning" role="status">{lang}wcf.user.register.needAdminActivation{/lang}</p>
+ {elseif !$__wcf->user->isEmailConfirmed()}
+ <p class="warning" role="status">{lang}wcf.user.register.needEmailConfirmation{/lang}</p>
+ {/if}
{/if}
{hascontent}
return 0;
}
- /**
- * Returns true if this user is activated.
- *
- * @return boolean
- * @since 5.3
- */
- public function isActivated() {
- return $this->activationCode == 0;
- }
-
/**
* Returns true if the email is confirmed.
*
* @return boolean
*/
public function canPurchasePaidSubscriptions() {
- return WCF::getUser()->userID && $this->isActivated();
+ return WCF::getUser()->userID && !$this->pendingActivation();
}
/**
* @since 5.2
*/
public function getBlacklistMatches() {
- if ($this->isActivated() && $this->blacklistMatches) {
+ if ($this->pendingActivation() && $this->blacklistMatches) {
$matches = JSON::decode($this->blacklistMatches);
if (is_array($matches)) {
return $matches;
return WCF::getLanguage()->get('wcf.user.' . $field);
}, $this->getBlacklistMatches());
}
+
+ /**
+ * Returns true if this user is not activated.
+ *
+ * @return boolean
+ * @since 5.3
+ */
+ public function pendingActivation() {
+ return $this->activationCode != 0;
+ }
+
+ /**
+ * Returns true if this user requires activation by the user.
+ *
+ * @return boolean
+ * @since 5.3
+ */
+ public function requiresEmailActivation() {
+ return REGISTER_ACTIVATION_METHOD & self::REGISTER_ACTIVATION_USER && $this->pendingActivation() && !$this->isEmailConfirmed();
+ }
+
+ /**
+ * Returns true if this user requires the activation by an admin.
+ *
+ * @return boolean
+ * @since 5.3
+ */
+ public function requiresAdminActivation() {
+ return REGISTER_ACTIVATION_METHOD & self::REGISTER_ACTIVATION_ADMIN && $this->pendingActivation();
+ }
+
+ /**
+ * Returns true if this user can confirm the email themself.
+ *
+ * @return boolean
+ * @since 5.3
+ */
+ public function canEmailConfirm() {
+ return REGISTER_ACTIVATION_METHOD & self::REGISTER_ACTIVATION_USER && !$this->isEmailConfirmed();
+ }
}
foreach ($this->objects as $object) {
/** @var UserEditor $object */
- if ($object->isActivated()) {
+ if (!$object->requiresEmailActivation()) {
throw new UserInputException('objectIDs');
}
}
* @return boolean
*/
public function canEditOwnProfile() {
- if (!$this->isActivated() || !$this->getPermission('user.profile.canEditUserProfile')) {
+ if ($this->pendingActivation() || !$this->getPermission('user.profile.canEditUserProfile')) {
return false;
}
$fixUserGroupIDs[$user->userID] = [UserGroup::EVERYONE];
$groupIDs[] = UserGroup::EVERYONE;
}
- if (!$user->isActivated()) {
+ if ($user->pendingActivation()) {
if (!in_array(UserGroup::GUESTS, $groupIDs)) {
if (!isset($fixUserGroupIDs[$user->userID])) $fixUserGroupIDs[$user->userID] = [];
$fixUserGroupIDs[$user->userID][] = UserGroup::GUESTS;
$this->saved();
// forward to index page
- if ((REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN) && !$this->user->isActivated()) {
+ if ($this->user->requiresAdminActivation()) {
$redirectText = WCF::getLanguage()->getDynamicVariable('wcf.user.registerActivation.success.awaitAdminActivation');
}
else {
public function checkPermissions() {
parent::checkPermissions();
- if (!WCF::getUser()->isActivated()) {
+ if (WCF::getUser()->pendingActivation()) {
throw new PermissionDeniedException();
}
}
$userIDs = [];
foreach ($this->objects as $user) {
/** @var User $user */
- if (!$user->isActivated()) $userIDs[] = $user->userID;
+ if ($user->pendingActivation()) $userIDs[] = $user->userID;
}
return $userIDs;
$userIDs = [];
foreach ($this->objects as $user) {
- if (!$user->isActivated()) $userIDs[] = $user->userID;
+ /** @var User $user */
+ if ($user->requiresEmailActivation()) $userIDs[] = $user->userID;
}
return $userIDs;
/** @noinspection PhpUndefinedFieldInspection */
$userIsEnabled = $condition->userIsEnabled;
if ($userIsEnabled !== null) {
- if ($userIsEnabled && !$user->isActivated()) {
+ if ($userIsEnabled && $user->pendingActivation()) {
return false;
}
- else if (!$userIsEnabled && $user->isActivated()) {
+ else if (!$userIsEnabled && !$user->pendingActivation()) {
return false;
}
}
}
}
- if ($user->isActivated()) $defaultGroupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::USERS]);
+ if (!$user->pendingActivation()) $defaultGroupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::USERS]);
else $defaultGroupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::GUESTS]);
$groupIDs = array_merge($groupIDs, $defaultGroupIDs);
dich{else}Sie
sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese E-Mail ignorieren.]]></item>
<item name="wcf.user.register.needAdminActivation"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Dein{else}Ihr{/if} Benutzerkonto muss noch von einem Administrator freigeschaltet werden, um den vollen Funktionsumfang dieser Seite nutzen zu können.]]></item>
- <item name="wcf.user.register.needEmailConfirmation"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Deine{else}Ihre{/if} E-Mail-Adresse muss noch bestätigt werden. <a href="{link controller='RegisterActivation'}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}Bestätige jetzt deine{else}Bestätigen Sie jetzt Ihre{/if} E-Mail-Adresse</a>.]]></item>
+ <item name="wcf.user.register.needEmailConfirmation"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Deine{else}Ihre{/if} E-Mail-Adresse muss bestätigt werden. {if $__wcf->user->canEmailConfirm()}<a href="{link controller='RegisterActivation'}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}Bestätige jetzt deine{else}Bestätigen Sie jetzt Ihre{/if} E-Mail-Adresse</a>{else}Wenden Sie sich dafür direkt an den Administrator dieser Seite{/if}.]]></item>
<!-- Success Messages -->
<item name="wcf.user.register.success"><![CDATA[Vielen Dank für die Registrierung, {$user->username}. {if LANGUAGE_USE_INFORMAL_VARIANT}Deine{else}Ihre{/if} Registrierung ist hiermit vollständig abgeschlossen.]]></item>
<item name="wcf.user.register.success.needActivation"><![CDATA[Vielen Dank für die Registrierung, {$user->username}.<br>
{link controller='RegisterActivation' isEmail=true}u={@$mailbox->getUser()->userID}&a={@$mailbox->getUser()->emailConfirmed}{/link} {* this line ends with a space *}
-Your activation code is: {@$mailbox->getUser()->activationCode} {* this line ends with a space *}
+Your activation code is: {@$mailbox->getUser()->emailConfirmed} {* this line ends with a space *}
If you have trouble confirming your email address, please contact the
administrator at: {@MAIL_ADMIN_ADDRESS}. Please ignore this email if you did
not register with us.]]></item>
<item name="wcf.user.register.needAdminActivation"><![CDATA[Your account must be activated by an administrator in order to use the full scope of the website.]]></item>
- <item name="wcf.user.register.needEmailConfirmation"><![CDATA[Your email address is not activated yet. <a href="{link controller='RegisterActivation'}{/link}">Activate now your email address</a>.]]></item>
+ <item name="wcf.user.register.needEmailConfirmation"><![CDATA[Your email address is not activated yet. <a href="{link controller='RegisterActivation'}{/link}">Activate now your email address</a>. {if $__wcf->user->canEmailConfirm()}<a href="{link controller='RegisterActivation'}{/link}">Confirm your email address</a>{else}To activate your email address contact the administrator of this site.{/if}.]]></item>
<!-- Success Messages -->
<item name="wcf.user.register.success"><![CDATA[Thank you for registering, {$user->username}.<br>
Your registration is now completed.]]></item>