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

somebodysysop’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for the post. Sorry, but I don't understand what you are trying to say.

Ghislain’s picture

Status: Postponed (maintainer needs more info) » Active

Ok 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) :

$edit['roles'] = array_merge(array($rid => ''), $edit['roles']);

Is it better this way ?
Hope it helps...

somebodysysop’s picture

Status: Active » Fixed

Modified and tested. Change committed to cvs. Should be available in dev release in about 12 hours.

          $edit['roles'][$rid] = $rid;

Thank you for your work on this.

somebodysysop’s picture

Assigned: Unassigned » somebodysysop

Committed to 6.x-1.4 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.