<classname>wcf\system\user\notification\object\type\UserFollowUserNotificationObjectType</classname>
<category>com.woltlab.wcf.user</category>
</type>
+ <type>
+ <name>com.woltlab.wcf.user.registration.notification</name>
+ <definitionname>com.woltlab.wcf.notification.objectType</definitionname>
+ <classname>wcf\system\user\notification\object\type\UserRegistrationUserNotificationObjectType</classname>
+ <category>com.woltlab.wcf.administration</category>
+ </type>
<type>
<name>com.woltlab.wcf.user.recentActivityEvent.follow</name>
<definitionname>com.woltlab.wcf.user.recentActivityEvent</definitionname>
--- /dev/null
+{assign var='count' value=$event->getAuthors()|count}{assign var='guestTimesTriggered' value=$event->getNotification()->guestTimesTriggered}{assign var='authors' value=$event->getAuthors()|array_values}
+{if $mimeType === 'text/plain'}
+ {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.plaintext{/lang}{/capture}
+ {lang}wcf.user.notification.userRegistration.mail.plaintext{/lang}
+{else}
+ {capture assign='authorList'}{lang}wcf.user.notification.mail.authorList.html{/lang}{/capture}
+ {lang}wcf.user.notification.userRegistration.mail.html{/lang}
+ {assign var='user' value=$event->getAuthor()}
+
+ {if $notificationType == 'instant'}{assign var='avatarSize' value=48}
+ {else}{assign var='avatarSize' value=32}{/if}
+ {capture assign='userContent'}
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$user->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
+ <td class="boxContent">
+ {include file='email_userInformationHeadline'}
+ </td>
+ </tr>
+ </table>
+ {/capture}
+ {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$userContent sandbox=true}
+{/if}
<classname>wcf\system\user\notification\event\ArticleUserNotificationEvent</classname>
<preset>1</preset>
</event>
+
+ <event>
+ <name>registration</name>
+ <objecttype>com.woltlab.wcf.user.registration.notification</objecttype>
+ <classname>wcf\system\user\notification\event\UserRegistrationUserNotificationEvent</classname>
+ <permissions>admin.user.canSearchUser</permissions>
+ <preset>0</preset>
+ </event>
</import>
</data>
use wcf\system\language\LanguageFactory;
use wcf\system\request\LinkHandler;
use wcf\system\user\authentication\UserAuthenticationFactory;
+use wcf\system\user\notification\object\UserRegistrationUserNotificationObject;
+use wcf\system\user\notification\UserNotificationHandler;
use wcf\system\WCF;
use wcf\util\HeaderUtil;
use wcf\util\StringUtil;
$email->send();
}
+ $this->fireNotificationEvent($user);
+
if ($this->captchaObjectType) {
$this->captchaObjectType->getProcessor()->reset();
}
HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable($this->message, ['user' => $user]), 15);
exit;
}
+
+ /**
+ * @param User $user
+ * @throws SystemException
+ * @since 5.2
+ */
+ protected function fireNotificationEvent(User $user) {
+ $recipientIDs = $this->getRecipientsForNotificationEvent();
+ if (!empty($recipientIDs)) {
+ UserNotificationHandler::getInstance()->fireEvent(
+ 'registration',
+ 'com.woltlab.wcf.user.registration.notification',
+ new UserRegistrationUserNotificationObject($user),
+ $recipientIDs
+ );
+ }
+ }
+
+ /**
+ * @return integer[]
+ * @since 5.2
+ */
+ protected function getRecipientsForNotificationEvent() {
+ $sql = "SELECT userID
+ FROM wcf".WCF_N."_user_to_group
+ WHERE groupID IN (
+ SELECT groupID
+ FROM wcf".WCF_N."_user_group_option_value
+ WHERE optionID IN (
+ SELECT optionID
+ FROM wcf".WCF_N."_user_group_option
+ WHERE optionName = ?
+ )
+ AND optionValue = ?
+ )";
+ $statement = WCF::getDB()->prepareStatement($sql, 100);
+ $statement->execute([
+ 'admin.user.canSearchUser',
+ 1
+ ]);
+ return $statement->fetchAll(\PDO::FETCH_COLUMN);
+ }
}
--- /dev/null
+<?php
+namespace wcf\system\user\notification\event;
+use wcf\data\user\UserProfile;
+use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\UserFollowUserNotificationObject;
+use wcf\system\user\notification\object\UserRegistrationUserNotificationObject;
+
+/**
+ * Notification event for new user registrations.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Notification\Event
+ * @since 5.2
+ *
+ * @method UserRegistrationUserNotificationObject getUserNotificationObject()
+ */
+class UserRegistrationUserNotificationEvent extends AbstractUserNotificationEvent implements ITestableUserNotificationEvent {
+ use TTestableUserNotificationEvent;
+
+ /**
+ * @inheritDoc
+ */
+ protected $stackable = true;
+
+ /**
+ * @inheritDoc
+ */
+ public function getTitle() {
+ $count = count($this->getAuthors());
+ if ($count > 1) {
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.userRegistration.title.stacked', ['count' => $count]);
+ }
+
+ return $this->getLanguage()->get('wcf.user.notification.userRegistration.title');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getMessage() {
+ $authors = array_values($this->getAuthors());
+ $count = count($authors);
+
+ if ($count > 1) {
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.userRegistration.message.stacked', [
+ 'author' => $this->author,
+ 'authors' => $authors,
+ 'count' => $count,
+ 'others' => $count - 1
+ ]);
+ }
+
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.userRegistration.message', ['author' => $this->author]);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getEmailMessage($notificationType = 'instant') {
+ return [
+ 'template' => 'email_notification_userRegistration',
+ 'application' => 'wcf'
+ ];
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getLink() {
+ return LinkHandler::getInstance()->getLink('User', ['object' => $this->author]);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getEventHash() {
+ return sha1($this->eventID);
+ }
+
+ /**
+ * @inheritDoc
+ * @return UserFollowUserNotificationObject[]
+ */
+ public static function getTestObjects(UserProfile $recipient, UserProfile $author) {
+ return [new UserRegistrationUserNotificationObject($author)];
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\user\notification\object;
+use wcf\data\DatabaseObjectDecorator;
+use wcf\data\user\User;
+
+/**
+ * Represents a new user registration as a notification object.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Notification\Object
+ * @since 5.2
+ *
+ * @method User getDecoratedObject()
+ * @mixin User
+ */
+class UserRegistrationUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject {
+ /**
+ * @inheritDoc
+ */
+ protected static $baseClass = User::class;
+
+ /**
+ * @inheritDoc
+ */
+ public function getTitle() {
+ return $this->getDecoratedObject()->getTitle();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getURL() {
+ return $this->getDecoratedObject()->getLink();
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getAuthorID() {
+ return $this->userID;
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\user\notification\object\type;
+use wcf\data\user\User;
+use wcf\data\user\UserList;
+use wcf\system\user\notification\object\UserRegistrationUserNotificationObject;
+
+/**
+ * Represents a new user registration as a notification object type.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Notification\Object\Type
+ * @since 5.2
+ */
+class UserRegistrationUserNotificationObjectType extends AbstractUserNotificationObjectType {
+ /**
+ * @inheritDoc
+ */
+ protected static $decoratorClassName = UserRegistrationUserNotificationObject::class;
+
+ /**
+ * @inheritDoc
+ */
+ protected static $objectClassName = User::class;
+
+ /**
+ * @inheritDoc
+ */
+ protected static $objectListClassName = UserList::class;
+}
<item name="wcf.user.notification.com.woltlab.wcf.userTrophy.notification.received"><![CDATA[Trophäe erhalten]]></item>
<item name="wcf.user.notification.trophy.received.title"><![CDATA[Trophäe erhalten]]></item>
<item name="wcf.user.notification.trophy.received.message"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} die Trophäe <a href="{$userTrophy->getTrophy()->getLink()}">{$userTrophy->getTrophy()->getTitle()}</a> erhalten.]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.administration"><![CDATA[Administration]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.user.registration.notification.registration"><![CDATA[Neue Registrierung durch Benutzer]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Neuer Kommentar in der Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.response.notification.commentResponse"><![CDATA[Neue Antwort auf einen Kommentar in der Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.articleComment.response.notification.commentResponseOwner"><![CDATA[Neue Antwort auf einen Kommentar zu Ihrem Artikel]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.articleComment.response.notification.commentResponse"><![CDATA[Neue Antwort auf einen Kommentar von Ihnen]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.articleComment.notification.comment"><![CDATA[Neuer Kommentar zu Ihrem Artikel]]></item>
+ <item name="wcf.user.notification.userRegistration.title"><![CDATA[Neue Benutzer-Registrierung]]></item>
+ <item name="wcf.user.notification.userRegistration.title.stacked"><![CDATA[{#$count} neue Benutzer-Registrierungen]]></item>
+ <item name="wcf.user.notification.userRegistration.message"><![CDATA[{@$author->getAnchorTag()} hat sich registriert.]]></item>
+ <item name="wcf.user.notification.userRegistration.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$others} weitere Benutzer{/if} haben sich registriert.]]></item>
+ <item name="wcf.user.notification.userRegistration.mail.plaintext"><![CDATA[{@$authorList} {if $count == 1}hat{else}haben{/if} sich registriert.]]></item>
+ <item name="wcf.user.notification.userRegistration.mail.html"><![CDATA[<p>{@$authorList} {if $count == 1}hat{else}haben{/if} sich registriert:</p>]]></item>
</category>
<category name="wcf.user.profile">
<item name="wcf.user.profile.content.about.noPublicData"><![CDATA[{if $userID == $__wcf->getUser()->userID}{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} noch keine sichtbaren Informationen hinterlegt.{else}Der Benutzer hat noch keine für {if LANGUAGE_USE_INFORMAL_VARIANT}dich{else}Sie{/if} sichtbaren Informationen hinterlegt.{/if}]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.userTrophy.notification.received"><![CDATA[Notify me when I receive a trophy]]></item>
<item name="wcf.user.notification.trophy.received.title"><![CDATA[Trophy received]]></item>
<item name="wcf.user.notification.trophy.received.message"><![CDATA[You received the trophy <a href="{$userTrophy->getTrophy()->getLink()}">{$userTrophy->getTrophy()->getTitle()}</a>.]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.administration"><![CDATA[Administration]]></item>
+ <item name="wcf.user.notification.com.woltlab.wcf.user.registration.notification.registration"><![CDATA[Notify me of new user registrations]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Notify me when new comments are written in moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.response.notification.commentResponse"><![CDATA[Notify me when new replies to comments are written in moderation]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.articleComment.response.notification.commentResponse"><![CDATA[Notify me of new replies to my comments]]></item>
<item name="wcf.user.notification.com.woltlab.wcf.articleComment.notification.comment"><![CDATA[Notify me of new comments on my articles]]></item>
<item name="wcf.user.notification.pageComment.responseOwner.title"><![CDATA[New reply (Page)]]></item>
+ <item name="wcf.user.notification.userRegistration.title"><![CDATA[New user registration]]></item>
+ <item name="wcf.user.notification.userRegistration.title.stacked"><![CDATA[{#$count} new user registrations]]></item>
+ <item name="wcf.user.notification.userRegistration.message"><![CDATA[{@$author->getAnchorTag()} has registered.]]></item>
+ <item name="wcf.user.notification.userRegistration.message.stacked"><![CDATA[{if $count < 4}{@$authors[0]->getAnchorTag()}{if $count == 2} and {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} and {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} and {#$others} other users{/if} have registered.]]></item>
+ <item name="wcf.user.notification.userRegistration.mail.plaintext"><![CDATA[{@$authorList} {if $count == 1}has{else}have{/if} registered.]]></item>
+ <item name="wcf.user.notification.userRegistration.mail.html"><![CDATA[<p>{@$authorList} {if $count == 1}has{else}have{/if} registered:</p>]]></item>
</category>
<category name="wcf.user.profile">
<item name="wcf.user.profile.content.about.noPublicData"><![CDATA[{if $userID == $__wcf->getUser()->userID}You have not provided any details yet.{else}There are not any details visible to you.{/if}]]></item>