Add "Chat With Me" button everywhere (for cometchat)

  Nessun commento

Compatible XF Versions: 1.5

Hi,

If you install comechat, you will see a "Chat With Me" button below avatar in messages. (Of course if you set it in ACP)

By default it has different problems:

Even guests can see that (Even if they don't have access to cometchat)

Its just in messages page. And no where else. (So chatting with users with no post is not possible)

If you want to chat with someone (who has post) you should find one of his/her post and start chatting from his postbit.

And there are lots of problems (Mostly with "sync chat with PC" option). But because they solved most of them (for my forum) and will include in next update, so I won't explain them.

But adding "Chat With Me" button is something that I added and I don't think they add it in their next updates. So lets see how to do that.

Open "member_card" template and find this:

Code:

<xen:if is="{$canStartConversation}"><a href="{xen:link conversations/add, '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></xen:if>

After that, Add this:

Code:

<xen:if is="{$xenAddOns.cometchat_plugin}"><a class="cometchatbutton" href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith({$user.user_id});">Start Chat</a></xen:if>

You can change "Start Chat" with everything that you want. (And because of its position, just members will see that button) Also because of the conditional statement around it, if you disable cometcaht, this button will be hidden too.

You can add this code to any template that you want, like profile page (That I added too)

If you disabled cometchat for mobile users, then open "EXTRA.css" and add this:

Code:

<xen:if is="@enableResponsive">

@media (max-width:480px) {

.cometchatbutton {

display: none;

}

}

</xen:if>

This will hide "Start Chat" button in member card (and/or any where that you added) from mobile users.

Hope to be useful.

Nessun commento :

Posta un commento