diff --git a/files/lib/bootstrap/com.woltlab.wcf.conversation.php b/files/lib/bootstrap/com.woltlab.wcf.conversation.php
index ec7cb573..0b6adc0c 100644
--- a/files/lib/bootstrap/com.woltlab.wcf.conversation.php
+++ b/files/lib/bootstrap/com.woltlab.wcf.conversation.php
@@ -1,10 +1,11 @@
register(
- \wcf\event\user\profile\UserProfileHeaderInteractionOptionCollecting::class,
- static function (\wcf\event\user\profile\UserProfileHeaderInteractionOptionCollecting $event) {
- if (
- MODULE_CONVERSATION
- && WCF::getUser()->userID
- && WCF::getSession()->getPermission('user.conversation.canUseConversation')
- && WCF::getSession()->getPermission('user.conversation.canStartConversation')
- && WCF::getUser()->userID != $event->user->userID
- ) {
- $event->register(UserProfileHeaderViewInteractionOption::forLink(
- WCF::getLanguage()->get('wcf.conversation.button.add'),
- LinkHandler::getInstance()->getControllerLink(ConversationAddForm::class, ['userID' => $event->user->userID])
- ));
+ if (
+ \MODULE_CONVERSATION
+ && WCF::getUser()->userID
+ && WCF::getSession()->getPermission('user.conversation.canUseConversation')
+ && WCF::getSession()->getPermission('user.conversation.canStartConversation')
+ ) {
+ $eventHandler->register(
+ \wcf\event\interaction\user\UserProfileInteractionCollecting::class,
+ static function (\wcf\event\interaction\user\UserProfileInteractionCollecting $event) {
+ $event->provider->addInteraction(
+ new class(
+ 'start-conversation',
+ isAvailableCallback: static fn(UserProfile $user) => WCF::getUser()->userID !== $user->userID
+ ) extends \wcf\system\interaction\AbstractInteraction {
+ #[\Override]
+ public function render(DatabaseObject $object): string
+ {
+ \assert($object instanceof UserProfile);
+
+ return \sprintf(
+ '%s',
+ StringUtil::encodeHTML(
+ LinkHandler::getInstance()->getControllerLink(
+ \wcf\form\ConversationAddForm::class,
+ ['userID' => $object->userID]
+ )
+ ),
+ WCF::getLanguage()->get('wcf.conversation.button.add')
+ );
+ }
+ }
+ );
}
- }
- );
+ );
+ }
$eventHandler->register(
\wcf\event\endpoint\ControllerCollecting::class,
diff --git a/templateListener.xml b/templateListener.xml
index a32f701d..e81a0ca4 100644
--- a/templateListener.xml
+++ b/templateListener.xml
@@ -13,12 +13,6 @@
buttons
-
- user
- userCard
- buttons
-
-
user
@@ -52,5 +46,10 @@
menuInteraction
+
+ user
+ userCard
+ buttons
+
diff --git a/templates/userCard_buttons_conversationButton.tpl b/templates/userCard_buttons_conversationButton.tpl
deleted file mode 100644
index b23fcc60..00000000
--- a/templates/userCard_buttons_conversationButton.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{if MODULE_CONVERSATION && $__wcf->user->userID && $__wcf->session->getPermission('user.conversation.canUseConversation') && $__wcf->session->getPermission('user.conversation.canStartConversation') && $user->userID != $__wcf->user->userID}
- {icon name='comments' type='solid' size=24}
-{/if}