Closed (fixed)
Project:
Auto Assign Role
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
22 Jul 2007 at 05:28 UTC
Updated:
12 Feb 2008 at 22:11 UTC
Jump to comment: Most recent file
It does not assign new users to a designated role, though I am sure for 100% that I correctly typed the name of the role in the module's settings. Could this module have a conflict with other modules? I use acl to make private forums, for example.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | autoassignrole_161170_0.patch | 1.19 KB | jscheel |
| #7 | autoassignrole_161170.patch | 847 bytes | jscheel |
| #3 | autoassignrole_fix_assign.patch | 820 bytes | jscheel |
Comments
Comment #1
pmcka commentedI'm having the same problem. It seems to happen after adding Login Toboggan.
Comment #2
matchu commentedThis module does not auto-assign roles to new users.
Comment #3
jscheel commentedOk, I've attached a patch that seems to fix the problem. Just updates the roles when the user is updated.
Comment #4
greggles@jscheel - it seems like you stumbled on a couple problems:
1) when editing a user you want the autoassignrole to be assigned. I'm not sure that's the correct behavior.
2) There is a possibility created by your change that now a user will already have that role which causes a db error.
This module works fine for me for normal users creating accounts, so I guess there must be another problem.
First, please note that it can't assign roles for users created by the admin (as the "known problems" on the front page of the site mentions.
Beyond that, I can only imagine that there is a module conflict of some sort. Can folks try disabling individual modules and see if that changes the situation?
Comment #5
yngens commentedAfter reading pmcka's post I had to gave up Login Toboggan in order to be able to use Auto Assign Role. For some reason they indeed do not work together.
Comment #6
jscheel commentedOk, I took another look at this. It doesn't make sense to set the user's role when they edit their profile. However, as a safeguard, why not assign the role when the user logs in? You won't get a database error because the SQL uses "ON DUPLICATE" to handle duplicate entries. This will also make it easy to mass modify the accounts. Let's say 2 months into your website, you realize that you want all registered users to automatically be assigned the "member" role. Then you just have to make the role, set it up to be autoassigned and the next time an existing user logs in, they will get the role, just like new users will.
Comment #7
jscheel commentedOk, attached a quick patch for my comment above.
Comment #8
jscheel commentedAfter talking to greggles, the above patch seems rather silly. This new one will only assign the role at login if it is the first time the user has ever logged in.
Comment #9
gregglesI'd still rather figure out why the module doesn't work consistently for new users. It works fine in my testing, so it must either be based on a different workflow (i.e. using a different signup form) or a conflict in different modules.
However, this approach seems much more reasonable to me and as a reasonable alternative to finding the root problem it could be the best solution.
Comment #10
jscheel commentedI think part of the problem is how the user signs in the first time. It looks like users who use the "one-time login" link don't get assigned roles. This may be a symptom of logintoboggan/autoassignrole's compatibility issues. Can anyone else verify? I don't have time right now.
Comment #11
9802008 commentedThanks for the handy module!
I do have logintoboggan and auto assign role installed and experience the same problem. Using devel I see that the correct role is allocated with a db_query:
0.1 1 autoassignrole_user INSERT INTO users_roles (uid, rid) values (22, 7)
however a few lines later user_save () function runs this query:
0.1 1 user_save DELETE FROM users_roles WHERE uid = 22
I don't get why it does that. The patch autoassignrole_161170_0.patch fixes the problem for me when the user logs in.
Comment #12
jscheel commentedHmm, I've come across another problem. In my patch above, I check the user->access to see if the user has ever logged in, so that their role isn't reset every time they log in. This doesn't work if the user is modified by the admin before they login, because their access time is modified.
For right now, if you modify a user before they ever log on, you have to set their role manually.
Comment #13
cyberswat commentedfixed by http://drupal.org/cvs?commit=98222
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.