I have encountered a problem which raises a fundamental question.
Yesterday I created a new Usergroup in my phpBB board. Today a new member attemped to register and got an error message saying the requested group_id number was not available. On checking, I discovered that phpbb.module puts every new member into a group that it creates with a group_id ==user_id. Because the next available group_id had been assigned to the new Usergroup (reasonably enough) it was not abailable to give to the next member who registered, so the registration failed. Not just that registration, of course, but all registrations until I dived into the DB and removed the problem.
Why is phpbb.module creating groups and putting members into them in the first place? If there is a good reason, how do I get round this problem?
Whilst on the subject, can you tell me the purpose of group_id = 1? Does it exist by default in phpBB?
Comments
Comment #1
arkepp commentedphpBB created a group for every user when I started writing this module. My goal was to emulate phpBB's default behavior as much as possible, I suspected a group-based permission system and did not worry about why it did that. This may have changed or create problems now, but I have not noticed this myself.
Try running a plain phpBB-installation and see what happens?
Comment #2
fronbow commentedFrom what I remember, when you register on a normal phpBB installation it automatically assigns each user to a "Personal User" group in the group table. If you look in the group table (if it hasn't been changed in any way?) then you will notice a field marked "group_single_user". Where this is 1, it should be a Personal User group.
I'm not sure, but I think this might be in some way similar to drupal's authenticated user role.
Comment #3
davidteall commentedI have done some experimenting as suggested. I disabled the .htaccess file and created a new user directly in phpBB:
My new User was given user_id 64 and was put into a newly-created group with group_id 68. An entry was created in phpbb_user_groups linking these two together.
The newly-created group had a 1 in group_single_user and 'Personal User' in group_description. By contrast, my actual Usergroups have a zero in group_single_user and the name of the Group in group_description.
So - the normal behaviour of phpBB is indeed to create a new group every time a new user is created and link the two together with an entry in phpbb_user_groups though they do not have to be the same number as both auto-increment independently.
This is where I believe phpbb.module is not emulating phpBB's normal behaviour correctly. I do not speak php/mysql well enough to fully understand what it is doing but I believe that it:
1. puts an entry in phpbb_users correctly accepting the auto-incremented user_id offered
2. attempts to put an entry in phpbb_groups incorrectly by forcing acceptance of the same number as offered for user_id instead of accepting the auto-incremented number.
3. Correctly puts an entry in phpbb_user_groups
The incorrect action in 2) does not matter until you create a Usergroup which takes up the next-available group_id number without affecting the user_id sequence. Then, next time a new user is created, the entry into phpbb_groups fails because the group_id number requested has already been taken.
Comment #4
arkepp commentedCool, I'll add a check this weekend, feel free to submit patches ;)
Comment #5
arkepp commentedPatch in CVS, uses same mechanism as phpBB 2.0.21 ( mysql_insert_id )
Comment #6
davidteall commentedThe copy I can find is dated 6th Sept. Is that the one? If not, where do I find the latest copy and what is it dated?
Comment #7
arkepp commentedMaybe you checked too early, the CVS-> .tar.gz is probable a cron-job
Comment #8
davidteall commentedYes - I've found it now. Many thanks.
Comment #9
arkepp commentedComment #10
arkepp commentedclosed is what I really wanted...