Its been an interesting few days studying the PM and Whos Online code.
I believe I may have found a roadmap to groupify PM module and Whos online block using resources that alreadyexist in XOOPS code. There is a function in members.php "getUsersByGroup" that appears to populate an array of users in a specific group. The logic in the approach is that if such an array can be created by using the group id one is currently logged into as the input in creating that array, then the array that results will contain only users in that group. With me so far?
PM
The $pmform.javascript referenced in the pm_pmlite.html appears to be associated with the assignment of usernames to the dropdown box. Under a groupified operation scope, this dropdown would be pointed to the user-by-group array instead of the global one. Since in this mode, someone in a given group would not have access to the username of someone in another group, he would be unable to send. Likewise, someone in an external group would be hogtied in the same way so you would never receive what was never sent.
But conditioning the ability to send or receive on matching groupid would be an additional consideration.
WHOS ONLINE
The whos online list is built in the system_blocks.php using a function called b_system_online_show. Line 16 of that function (not line 16 of the file) is where the whos online directory that gets linked to from the Whos Online block gets built.
So again, if this gets mapped to the usernames in the user-by-group array instead of global usernames, then only those who are in the currently logged in group would appear in that groups display.
THE MISSING LINK
The missing link in this approach is learning how to detect the id of the group I am currently logged into. To this end, I have made use of the following script to return the value for the group I am currently logged in as (not necessarily knowing what this should be):
<{php}> if (is_object($GLOBALS['xoopsUser'])) {
echo '';
}
<{/php}>
Upon executing this, I get the following result:
var CurrentGroup = "";
Empty quotes result for the groupid data.
Note that when I substitute user name and id variables as input, this same script successfully populates the quotes with the correct data, so the script itself works.
Are empty quotes the correct or expected result for a group you are currently logged into, if so how would a comparison be made?
Or is there supposed to be data such as an integer or text description for the current group?
Is groupid even the correct variable or should it be something else? It seems to be the one used throughout XOOPS.
I believe the answer to this question will be the key that can be leveraged into much bigger gains, and I will share the results as I move along through this. Of course, what I wrote here only addresses the basics of the possibilities we discussed above.Wow
If anyone can share their expertise on these questions or this subject, it would be greatly appreciated, and hopefully result in additional capabilities to the status quo.
Thanks