hi, im just wondering why the user role that is picked at registration isn't being assigned to the user. basically, what happens is that the user picks the role at registration, but when you look at the user's list, you notice a blank bullet. the user is not assigned to any role (see images, and there's a red dot to show which user im talking about).

any help would be appreciated. thank you in advance!

ps. i've attached 2 screenshots -- the settings page for the module & the user list.

CommentFileSizeAuthor
assignrole2.png32.65 KBtanjerine
assignrole1.png35.34 KBtanjerine

Comments

tanjerine’s picture

edit: the form looks like this --

//snipped code
input type="radio" name="AUTOASSIGNROLE_ROLE_USER" value="0" class="form-radio"
//snipped code

is that correct? basically, its showing the wrong value for the right option.

edit: i managed to fix it. i'm just not sure if it's the right fix. i commented out this:

// commented out as it was not showing the right values for role_ids. 
/*if(variable_get("AUTOASSIGNROLE_ROLE_SORT", "SORT_ASC") == "SORT_ASC") {
    array_multisort($result,SORT_ASC);
  } else {
  	array_multisort($result,SORT_DESC);
}*/
whatthe’s picture

Hello tanjerine!!!

I have exactly the same problem!!!
This module is exactly what I need...BUT it doesn't work!!!
You say that you managed to fix it!!
How ???? can you please give me a clue, because you seem to have understand the issue!!

Thanks!

tanjerine’s picture

hi! basically, what i did was i commented out the code (read above post) in the autoassignrole.module (start from line 197 of the file):

function _autoassignrole_intersect() {
  $autoassignrole_roles = variable_get("AUTOASSIGNROLE_ROLE_USER","");
  //print "<div style=\"width:500px;\"><pre>"; print_r($autoassignrole_roles);  print "</pre></div>";
  foreach($autoassignrole_roles as $key => $value) {
    if($value == 0) {
      unset($autoassignrole_roles[$key]);
    }
  }
  $result = _autoassignrole_array_intersect_key(user_roles(), $autoassignrole_roles);
  //print "<div style=\"width:500px;\"><pre>"; print_r($result);  print "</pre></div>";

  // commented out as it was not showing the right values for role_ids. - sarah20080310
  /*if(variable_get("AUTOASSIGNROLE_ROLE_SORT", "SORT_ASC") == "SORT_ASC") {
    array_multisort($result,SORT_ASC);
  } else {
  	array_multisort($result,SORT_DESC);
  }*/
  //print "<div style=\"width:500px;\"><pre>"; print_r($result);  print "</pre></div>";
  return $result;
}

hope this helps.

andypost’s picture

Status: Active » Needs review
cyberswat’s picture

Status: Needs review » Fixed
cyberswat’s picture

Assigned: Unassigned » cyberswat
Anonymous’s picture

Status: Fixed » Closed (fixed)

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