Closed (fixed)
Project:
OG User Roles
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
11 Feb 2009 at 13:17 UTC
Updated:
11 Mar 2009 at 06:00 UTC
Hi (and first of all : thanks for your work ! - second, sorry for my english, just in case ;-)
Found a little something (or am wrong) in og_user_roles.module (6.x-1.3), line 1491 :
If "site admin opted to create a default role", then you db_query(INSERT...) into user_roles table. As far as I understood, user_save() will break it : db_query('DELETE...) in user.module line 255.
if ($output == 0) {
db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $user->uid, $rid);
}
might become :
if ($output == 0) {
$edit['roles'] = array($rid => ''); // we don't care about it's name
}
Hope I didn't make you loosing your time
Thanks,
Ghislain
Comments
Comment #1
somebodysysop commentedThanks for the post. Sorry, but I don't understand what you are trying to say.
Comment #2
Ghislain commentedOk sorry, I try again :
I make a fresh install to be sure, only drupal-6.9, cck-6-x-2.1, og-6.x-1.1 and og-user-roles-6.x-1.3.
I add a role "contributor" and a type "group" : the default og group.
I allow visitors to create account without verification (my local server neither sends emails nor is reachable from outside)
I go in admin/og/og_user_roles, "Default Non-Group Role for new users." :
I check "Set default global (site-wide) role for new signups?" and select the role : "contributor".
I log out.
I create a new account : "toto"
I log out, log again with user 1, the installer, root, God (ok you see who I mean). I go to admin/user/user : and I can see toto has no role !
I guess there is a bug ;-)
Which is located in the file og_user_roles.module, line 1491 (as I tried to explain) :
In this file we make a db_query, but user_save() which will happend after, will delete the fresh entry...
So I propose to use the drupal way and modify the $edit array. Earlier I wrote $edit['roles'] = array($rid => ''), it should be nice to preserve $edit_roles in case it's been hooked by another module, with something like (untested) :
Is it better this way ?
Hope it helps...
Comment #3
somebodysysop commentedModified and tested. Change committed to cvs. Should be available in dev release in about 12 hours.
Thank you for your work on this.
Comment #4
somebodysysop commentedCommitted to 6.x-1.4 release.