Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Plugins by
I would like to enable XMPP chat on my Q2A page. I already have a ejabberd server running, so it is only a question of getting a smooth integration with Q2A.

The best option seems to be this:


My idea is that the on-site pop-up chat should only be loaded for logged-in users (ideally getting the user data out of the Q2A database, as this is also where my ejabbered server indirectly gets its login data), and a full page chat with anonymous log-in as a  Q2A page (or maybe one per categrory?).

I guess to really get that working one would need to write a plugin, but is there a easy way I can make sure the javascript for the pop-up chat is only loaded for logged-in users as a start?
Q2A version: 1.8 beta

1 Answer

+1 vote

As explained in the docs, there is a function to check for a user being logged in or not: qa_is_logged_in(). So all you need to do is:

if (qa_is_logged_in()) {

    // Code to insert your JavaScript