Topic: Query Groups, Set Values, and Pass to Javascript UI
I'm trying to work out a way to:
Set up an Admin Panel
List out all user groups on my extension's admin panel (separate from the group permissions admin panel).
Put all the groups in to an array(); I think this would be the easiest way to work with them. Let me know if it isnt...
Allow the user to assign groups to four different permission levels. Most likely using a text field(permission level) & Label(group name) field they can just type 1-4 on each of them to set it.
Store each of the values into the $forum_config['values']... somehow... Can I do something like "'o_extensionname_groupperm_'.$id" or something?
Each permission level (0-3) would start off at the most restrictive (only admins, but can be changed by the user), then a little less restrictive, while still keeping the previous groups in it. (ie: group[0] = 'admins'; group[1] = 'admins, mods, privuser'; group[2] = 'admins, mods, privuser, default users'; group[3] = 'admins, mods, privuser, default users, guests';)
Next, pass along certain values to a javascript ui
Send which group(0-3) the user's group falls into via $_POST to the javascript.
The user will be able to pick (from the javascript ui) a group(0-3) level that they can send messages but they can't receive or send messages higher than what is set in the admin panel (option will be grayed out).
I know how to call the proper hook to make the admin panel, but I'm clueless on how to list out all the user groups and allow the admin the ability to assign them to my groups for chat privileges(group(0-3)). I think once I can get them assigned, they'll be easy to send to the javascript via $_POST. Does that sound correct or am I making this too complicated? If you haven't already realized it, this is for a javascript chat extension and I'm trying to have different permission levels that can be selected when sending messages (never higher than what permissions their group is given in the admin panel) and then they can only receive up to their permission level, and anything they can receive is shown in different colors (so admin messages are red, next level down is orange, next level is green, lowest public level that everyone can see is black).
I can do the javascript for what I need, I just need help to know which functions built into PunBB to use in php since I'm not that accustomed to it yet.
Can anyone throw any bit of insight (mainly how to list out all the groups and store them in $forum_config with the selected values in my extensions admin panel in a way that if the groups are ever modified or removed in punbb, it won't cause problems with my extension or the javascript ui)? I'm going cross-eyed trying to look through all the functions in admin/groups.php without knowing exactly what I'm looking for.