When the role is assigned, the value of the role in the $user object is supposed to be the role name, not the role ID. But roles assigned by autoassignrole are in the form

$user->roles[4] = 4

instead of the correct (assuming the 'kid' role is number 4):

$user->roles[4] = 'kid';

This often works, but is not correct.

The attached patch changes autoassignrole to use the role name as the value in the roles array.

CommentFileSizeAuthor
autoassignrole_role_name_01.patch1.11 KBrfay

Comments

rfay’s picture

This may not be worth spending much time on, as when the $user is later loaded, Drupal puts it together correctly. The only time this (small) flaw affects things in during the user_save() process. It might as well be fixed, but it won't have wide effects, I don't think.

cyberswat’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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