Group Assignment

So far the Reg Codes process seems to work great, with one exception. It assigns the default 'Member' group as well as the intended group in the configuration when going through the registration process.

For example, I have a group called 'Client'. I have a Reg Code assigned so that when a user uses that Reg Code, they will belong to the 'Client' group. However, they are also assigned to the 'Member' group during the registration process.

I am using Formulize 2.2 RC1, Reg Codes 2.2 RC1, Pageworks 2.2 RC1 and XOOPS 2.0.14.


RE: Group Assignment


That is by design actually. Since by default XOOPS always puts all users in the "Registered Users" group, we thought it would be important to keep all users in there. That seemed like an important convention within the XOOPS way of doing things.

It seems like the general idea behind that group is that if you want to assign a permission to all users of your site, then you are supposed to be able to assign it to that group, and that will catch everyone.

If you don't put everyone in that group, then you have no easy way of assigning any settings to everyone in your site.

So what we typically do is we actually hand out almost no permissions to Registered Users, with the exception of access to Formulize and the user profile form, and maybe access to the menu block and in some sites we allow them to access announcements (News), because maybe announcements is a fundamental part of how the site works and everyone should get announcements.

But all other permissions, to the specific discussion forums for instance, and to specific forms, is handled through special new groups that we create for that site.

So the registration codes put people in the correct other groups, and also in Registered Users. (This is also why the Registered Users group is actually ignored in a bunch of places within the Formulize code, since things like "all users in your group(s)" don't work right if you include "Registered Users", when that group includes everyone in your site -- all users in your group(s) would be the same as all users, period.)

So, bottom line is that the way Registration Codes is designed is perhaps not compatible with how you have the group permissions set up in your XOOPS site. I would suggest the "correct" solution would be to re-organize the permission structure. But that may not be practical.

You should be able to modify the behaviour of the Registration Codes module fairly easily so it doesn't put people in the Registered Users group, by altering the code around line 216 of the reg_codes\include\functions.php file. Just comment out some lines -- "comment out" means putting "//" at the front of the lines, so they would look something like this when you're done:

// if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
//   echo _US_REGISTERNG;
//   include 'footer.php';
//   exit();
// }

That will cause those lines to NOT be read when the page loads, so new users will not be added to the Registered Users group.

If you know something about how XOOPS modules work, and how the xoops_version.php file is setup, it would be fairly simple to turn this into another configuration option for the module, so webmasters would have the option of whether they wanted Registered Users included or not.

Does this help?


RE: Group Assignment

Thanks Julian!

Yes, that does help. I was wondering if it was designed as a default. I prefer not to hack the code unless absolutely necessary, so I will make the Registered Users group the least common denominator and follow the approach you described above.