[cXF] Direct Message Button

[cXF] Direct Message Button 1.5.0

No permission to download
As said, in style properties. If it does not work, check template modifications for this add-on if all modifications are applied.
 
Hello @BassMan , thank you for this great add-on.
Can we prevent it from redirecting to another page when we click on the icon?

Like that :


1734359240183.webp


I did try on /src/addons/BassMan/ConversationButton/_data template_modifications.xml
14 and 22 changed
Code:
class="cxf-button button--link" data-xf-click="overlay">
36 and 44 changed
Code:
class="cxf-icon button--link" data-xf-click="overlay">

But it doesn't work that way...

xenForo version : 2.2.15
I hope you can help me. Thank you.




I did it and it's working now, but can you check it please and correct me if I'm wrong?

Code:
<?xml version="1.0" encoding="utf-8"?>
<template_modifications>
  <modification type="public" template="extra.less" modification_key="cb_extra_less" execution_order="10" enabled="1" action="preg_replace">
    <find><![CDATA[/^.*$/s]]></find>
    <replace><![CDATA[$0

{{ include('cxf_conversation_button.less') }}]]></replace>
  </modification>
  <modification type="public" template="message_macros" modification_key="cb_2" description="Add conversation button above message user extra (user details)" execution_order="10" enabled="1" action="str_replace">
    <find><![CDATA[        <xf:if is="$user.user_id">]]></find>
    <replace><![CDATA[<xf:if is="property('cb_thread_title') == 'enabled'">
    <xf:if is="$__globals.thread AND $user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_bud') == 'above'">
            <xf:button href="{{ link('conversations/add', '', {'to': $user.username, 'title': $__globals.thread.title}) }}" class="cxf-button button--link">
                {{ phrase('start_conversation') }}
            </xf:button>
        </xf:if>
    </xf:if>
<xf:else />
    <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_bud') == 'above'">
            <xf:button href="{{ link('conversations/add', '', {'to': $user.username}) }}" class="cxf-button button--link">
                {{ phrase('start_conversation') }}
            </xf:button>
        </xf:if>
    </xf:if>
</xf:if>
$0]]></replace>
  </modification>
  <modification type="public" template="message_macros" modification_key="cb_2_below" description="Add conversation button below message user extra (user details)" execution_order="10" enabled="1" action="str_replace">
    <find><![CDATA[        <span class="message-userArrow"></span>
    </section>]]></find>
    <replace><![CDATA[<xf:if is="property('cb_thread_title') == 'enabled'">
    <xf:if is="$__globals.thread AND $user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_bud') == 'below'">
            <xf:button href="{{ link('conversations/add', '', {'to': $user.username, 'title': $__globals.thread.title}) }}" class="cxf-button button--link">
                {{ phrase('start_conversation') }}
            </xf:button>
        </xf:if>
    </xf:if>
<xf:else />
    <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_bud') == 'below'">
            <xf:button href="{{ link('conversations/add', '', {'to': $user.username}) }}" class="cxf-button button--link">
                {{ phrase('start_conversation') }}
            </xf:button>
        </xf:if>
    </xf:if>
</xf:if>
$0]]></replace>
  </modification>
  <modification type="public" template="message_macros" modification_key="cb_icon" description="Conversation icon beside username in message" execution_order="10" enabled="1" action="preg_replace">
    <find><![CDATA[/<h4 class="message-name(.*)\/>/isU]]></find>
    <replace><![CDATA[$0
<xf:if is="property('cb_thread_title') == 'enabled'">
    <xf:if is="$__globals.thread AND $user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_ibu') == 'enabled'">
            <span class="cxf-cb-icon"><a href="{{ link('conversations/add', '', {'to': $user.username, 'title': $__globals.thread.title}) }}" class="cxf-icon button--link" data-xf-click="overlay"><xf:fa icon="{{ property('cb_icon') }}" data-xf-init="tooltip" title="{{ phrase('start_conversation')}}" /></a></span>
        </xf:if>
    </xf:if>
<xf:else />
    <xf:if is="$user.user_id AND $xf.visitor.canStartConversationWith($user)">
        <xf:if is="property('cb_ibu') == 'enabled'">
            <span class="cxf-cb-icon"><a href="{{ link('conversations/add', '', {'to': $user.username}) }}" class="cxf-icon button--link" data-xf-click="overlay"><xf:fa icon="{{ property('cb_icon') }}" data-xf-init="tooltip" title="{{ phrase('start_conversation')}}" /></a></span>
        </xf:if>
    </xf:if>
</xf:if>]]></replace>
  </modification>
</template_modifications>
 
Last edited:
I don't remember now why I removed that option, but something was not working right when using the overlay option. I think something with attachments.
 
I don't remember now why I removed that option, but something was not working right when using the overlay option. I think something with attachments.
It seems to be working stable now. I added an attachment and sent a message but there seems to be no error. If I understand you correctly.
 
Back
Top Bottom