I installed Registration Role (RR) and it was working fine. I then installed LT, and although RR initially assigns the correct role upon registration, when LT processes the confirmation email it drops the assigned role. Here is the code from Registration Role that I assume assigns the role:

/**
 * Implementation of hook_user().
 *
 * Catch every registration and insert role
 */
 
function registration_role_user ($op, &$edit, &$user, $category=null)
{
  if ($op == "insert" && $rid = variable_get('registration_role_roles', ''))
  {
    // below does not seem safe!  or necessary for insert. Commented out
    // clear first
    // db_query( 'DELETE FROM {users_roles} WHERE uid = %d', $user->uid );

    db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)', $user->uid, $rid);
  }
}

I have cross posted on the RR project, as I am not sure which maintainer should handle this. Any help would be greatly appreciated. Thanks!

Comments

hunmonk’s picture

Project: LoginToboggan » Registration role
Version: 5.x-1.3 » 5.x-1.x-dev

from logintoboggan_user_register_submit():
$roles = isset($form_values['roles']) ? array_filter($form_values['roles']) : array();

registration role should not be operating on the database directly, but rather on the form data. it's the job of user_save() to manage the saving of roles to the database.

tbartels’s picture

I have a fix for this posted here: http://drupal.org/node/362067#comment-1353712

mlncn’s picture

Status: Active » Closed (duplicate)

I fixed this in the D5 branch six months ago but never created a release. I am a baaaaaaaad maintainer.

Duplicate of http://drupal.org/node/362067