Add conversation button to user cards
authorMarcel Werk <burntime@woltlab.com>
Fri, 26 Jan 2024 12:01:35 +0000 (13:01 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 26 Jan 2024 12:01:35 +0000 (13:01 +0100)
templateListener.xml
templates/userCard_buttons_conversationButton.tpl [new file with mode: 0644]

index bc8b25821b1c17d0638f477e7fc1f65cc2fb83ec..0ad56905c7138d3726ddd73e56f5482069754edd 100644 (file)
                        <eventname>buttons</eventname>
                        <templatecode><![CDATA[{include file='__userInformationStartConversation'}]]></templatecode>
                </templatelistener>
+               <templatelistener name="userCardConversationButton">
+                       <environment>user</environment>
+                       <templatename>userCard</templatename>
+                       <eventname>buttons</eventname>
+                       <templatecode><![CDATA[{include file='userCard_buttons_conversationButton'}]]></templatecode>
+               </templatelistener>
                
                <templatelistener name="searchAreaConversationSettings">
                        <environment>user</environment>
diff --git a/templates/userCard_buttons_conversationButton.tpl b/templates/userCard_buttons_conversationButton.tpl
new file mode 100644 (file)
index 0000000..55a2ece
--- /dev/null
@@ -0,0 +1,3 @@
+{if MODULE_CONVERSATION && $__wcf->user->userID && $__wcf->session->getPermission('user.conversation.canUseConversation') && $__wcf->session->getPermission('user.conversation.canStartConversation') && $user->userID != $__wcf->user->userID}
+       <a class="userCard__button jsTooltip" href="{link controller='ConversationAdd'}userID={@$user->userID}{/link}" title="{lang}wcf.conversation.button.add{/lang}">{icon name='comments' type='solid' size=24}</a>
+{/if}