Ok, quite simply, I want to know how to display both the users in chat and the sum total on the homepage and Members|Online pages.
Now, I've only heard murmurings of doing this and some people have at least determined the database table RayChatCurrentUsers is key. I think that much is probably true.
I've learned a few things so far. Table RayChatCurrentUsers does contain some entries for chat users. This table doesn't flush some of the entries of users who logged out weeks or months ago. So you can maybe overcome this by restricting results using the timestamp for the field "when." This opens up several more cans of worms, but we can worry about that a little later.
Additionally, I'm beginning to believe that there's a separate database on the RMS server if you use an RMS? When I have my offsite RMS enabled, the RayChatCurrentUsers table seems to remain unchanged. If I disable my RMS, then the table will update a user entry when the user enters the chatroom.
Now, on the assumption that the RMS does have it's own database, I need to figure out how to connect to it in my test script. Looking in the ray/modules/global/inc folder you'll find a db.inc.php file that has the key "mysql_connect" call. The structure of the file is very similar to the Dolphin's general inc/db.inc.php file. And all the database connection details (server, port, username, password, etc.) are stored for Dolphin in the header.inc.php file. However, the ray/modules/global/inc/header.inc.php file does reference some "$db['host']", etc. but it's never defined.
As the Ray php files don't have specific include statements, I haven't been able to track down where "$db['host']", "$db['passwd']", etc. are defined for Ray. Of course, at some point the host and port are read in through the Admin Panel configuration settings, but I can't find that code either. Presumably the username and password are blank or some sort of generic since it doesn't need to be specified for setting up the RMS. The RMS handles authentication by simply only allowing connections from a specific domain, and nothing else.
I tried to hack/divine what the 6 connection parameters were by inserting this code:
$myFile = "/[path to some directory]/someOutputFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, DB_HOST);
fwrite($fh, "\n");
fwrite($fh, DB_PORT);
fwrite($fh, "\n");
fwrite($fh, DB_SOCKET);
fwrite($fh, "\n");
fwrite($fh, DB_NAME);
fwrite($fh, "\n");
fwrite($fh, DB_USER);
fwrite($fh, "\n");
fwrite($fh, DB_PASSWORD);
fwrite($fh, "\n");
fclose($fh);
just before the line:
$oDb = new BxDbConnect(DB_HOST, DB_PORT, DB_SOCKET, DB_NAME, DB_USER, DB_PASSWORD);
$oDb->connect();
in ray/modules/global/inc/db.inc.php. I was expecting that the next time a user entered chat, the Ray system would connect to the database and trigger this debug code. Rather strangely, it never ran (or the output never occurred) when a user connected to chat either with or without the RMS enabled.
So I'm out of ideas of how to figure this out and get it working.