Hello John,
I'm a little bit frustrated. I spend hours trying to understand the code, but I can't.
I use the Community Builder and created a custom field to be able to configure to use the chat yes or no. Therefore I have included this code in the plugin file:
private function injectApp ($ cParams, $ app) {
$ user = JFactory :: getUser ();
if (! $ user-> id &&! ​​$ cParams-> get ('guest abled', false)) {
return;
}
// MS 9/21/2014
// Check if chat turned off, When yes then exit
$ cbUser = CBuser :: getInstance ($ user-> id);
$ cbChat = $ cbUser-> getField ('cb_chat', null, 'csv', 'none', 'profile', 0, true);
if ($ cbChat == 'no chat'
{
return;
}
...
This works so far. The user set its user profile field to "no chat" and the chat disappears.
Problem: The user is still displayed in the buddy list for other users. I have tried various changes in the files stream and sender, as well as in the plugin file. Partly in the main.js, but all without success.
By the way, I wonder that the entries of table jchat_status never deleted. Therefore, I have included in the plugin file additionally this code:
// Delete old chat status entries
$ database = JFactory :: getDBO ();
$ sql = "DELETE FROM WHERE #__jchat_status userid NOT IN (SELECT session_id FROM WHERE userid #__session <> 0)";
$ database-> setQuery ($ sql);
$ result = $ database-> query ();
Now, the user should not only be able to turn on/off the chat completely, He also should be able to start the chat in the inactiv mode (like chat options > turn off chat). To do this, I would like to use the above CB custom field also. But I can't find the procedure, function or variables to put chat in this mode.
Another Question. When exactly a row creates in the table jchat_status?
At least not at login, but the user is immediately visible in the buddy list. Is this the concept?
Please enlighten me. Thanks a lot.
Regards Michael