Closed (fixed)
Project:
Role Expire
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
27 Aug 2009 at 16:31 UTC
Updated:
10 Apr 2011 at 12:20 UTC
Our user profiles have three tabs, the main "Account" tab, a "Personal Information" tab for our custom fields, and a "Taxonomy-based access" tab provided by the Taxonomy Access Control Lite module. If I make and save changes on either the "Personal Information" tab or the "Taxonomy-based access" tab, any role expiration dates are removed, although the role itself is still assigned.
Comments
Comment #1
a.bond commentedIs anyone going to fix this bug? It makes life very inconvenient.
Comment #2
stewsnoozeI am on holiday this week. I will fix this on monday.
Sorry for the delay
Stew
Comment #3
stewsnoozeI am on holiday this week. I will fix this on monday.
Sorry for the delay
Stew
Comment #4
stewsnoozeI am on holiday this week. I will fix this on monday.
Sorry for the delay
Stew
Comment #5
stewsnoozeI think I've found the bug.
In role_expire_user (hook_user)
case update and insert we always delete roles when the $role is not set. I need to check the form to make sure it was actually in there.
Comment #6
stewsnoozeMark Theunissen (http://drupal.org/user/108606) and I have fixed this in CVS HEAD, do you want to try that version so we can check back if you experience bad behaviour before I do a full release or do you require a full release today?
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/role_expire... will give you a link to get a new role_expire.module file for testing.
Let me know how you get on?
Comment #7
stewsnoozeFixed as part of 6.x-1.4.
Comment #9
a.bond commentedToday I upgraded to 6.x-1.6 and this bug has returned. Same as original, when I save changes to other tabs, role expirations vanish.
Comment #10
stewsnoozeAre you just downgrading until this is fixed?
Comment #11
a.bond commentedI'm downgrading, this bug makes the module far too difficult to work with.
Comment #12
stewsnoozePlease test in 1.7. I really think I have it now. I fixed it in a more sustainable way this time. Big Big Apologies
Comment #13
stewsnoozeComment #14
a.bond commentedJust upgraded to 1.7 and it's working again. Thanks for the quick update.
Comment #15
bobgeier commentedHate to rain on the party, but I'm experiencing the same bug in 6.x-1.7, or perhaps a slightly different variant.
In my case, if a user who does not have permissions to administer roles (like the average user) updates their account information in any way, it erases the role expiration date. This renders the module functionally useless.
Comment #16
vacilando commentedSame problem in 6.x-1.7 -- the role expiration dates are disappearing (possibly as described in #15).
Comment #17
tuccio commentedHello, I am also experiencing a similar issue. I have a system with the Registration Code module. Upon entering the code at registration, the user gets assigned a Valid_code role expiring in 365 days. Then on submitting the Contact form (it's a free consultation system) the user gets assigned, through Rules, a Monthly_filter role that expires in 30 days and prevents the user from submitting the form more often than once a month. Well, when the second role (Monthly_filter) gets assigned to the user, the expiration of the first role (Valid_code) gets erased. At first I thought it was a problem with Reg Code module (which has a role assignment functionality) so I modified the system not to use the Reg Code module role functionality, but the problem is still present now that I am only using Rules and Role Expire so I suspect the problem might be with Role Expire. Any help is greatly appreciated and thank you for the great module.
Comment #18
tuccio commentedI inserted some debug output and the problem seems still to occur inside the
block of the "insert" case of hook_user() which gets executed also when it should not.
However I am not very good at programming so at this time I cannot be of further help. But this problem needs to be fixed ASAP!
Comment #19
tuccio commentedMore info: today I had a user who just requested a new password, and both his role expirations vanished.
Comment #20
bobgeier commentedWell, not being able to trace the bug, I can at least mention that if you comment out the line that tuccio lists in #18 it seems to make everything OK, except that you can no longer delete an expiration date on a role, only modify it or add it.
That might be enough for people to at least have adequate functionality until a real patch gets done.
Comment #21
stewsnoozeHi,
The bug exists because the current design of the module allows any page that modifies the user object e.g hook_user to change the roles and it saves them.
The module basically should probably abandon the edit anywhere approach and simply support role expiration actions on the specified forms. e.g. /user/xxx/edit/xxx and the user admin create form. Are you saving data with this module in any way other than the default /user/xxx/edit/xxx pages?
Comment #22
stewsnoozeI've committed some code to CVS HEAD that doesn't remove the expiries when on other tabs. I'd love someone to test it on an instance they have had failures or have reproduced it on.
Any takers before I release this?
There should be a dev release for download on the role_expire project page within a day for testing.
Stew
Comment #23
stewsnoozeI should note here that for the next release people who are using hook_user to manipulate role_expire (role expiry) will need to make sure that category is set to 'account' or similar.
Comment #24
stewsnoozeComment #25
stewsnoozeReleased in 6.x.1.8
Comment #26
aitala commentedI just installed the update and I don't think it fixes the problem.
Tested on a site - account has a role with an expire date, user requests new password, logs in with one-time link, changes password. I check account with admin user and the role expire date is gone but user still has the role.
Eric
Comment #27
stewsnoozeok thanks for this. I'll try and reproduce again.
Comment #28
spacereactor commentedtest with 6.x.1.8 and user expire role is gone after update/edit user profile.
Comment #29
stewsnoozeThis is a ridiculously embarrassing issue. An easy to fix bug that I have failed to do. Big Big Apologies. Comment #26 made me click that it was the actual user deleting their own role rather than the administrative user. Reading back beyond that I see that it is clear before then. I was so obsessed with thinking that the "administer users" role users were blanking it as the bug came back when I had committed admin users creating role expiry dates when they create users.
Big apologies. I believe this is fixed in 1.9.
Can one of you very patient folks please confirm that this is fixed for you?
Comment #30
spacereactor commentedso far it seem to work for me, but i only test when user update/edit own profile and the expire role remain. :) THANK!!
Comment #31
aitala commentedThat appears to have worked as far as I can tell.
Eric
Comment #32
stewsnoozeComment #33
a.bond commentedUsing a bulk operation to add a role clears the expiration date of other roles.
Comment #34
stewsnoozea "bulk operation" ? Are you using views bulk operations? can you explain the steps you took to get this bug in more detail please
Comment #35
stewsnoozeComment #36
a.bond commentedYes, I'm using Views Bulk Operations. I have a Bulk Operations view created. When I use that view to apply a new role to users (views_bulk_operations_user_roles_action), it erases the expiration dates of any roles.
Comment #37
vacilando commentedAs of version 1.9 expiration dates are present when re-editing. The initial problem seems to be solved...?
Comment #38
stewsnoozeI agree. Lets close this issue and the VBO one can be separate
Comment #40
btown commentedHi Stew,
I'm using the current dev version and having the same problem with disappearing expiry dates. Originally I was using VBO, but given the discussion here, I changed so that users are flagging a node (using a simple link) in a table generated by views. Here's a quick overview of our set-up:
Users can publish and unpublish nodes that they have authored. They publish by flagging a node, which triggers a rule. The rule checks the user's roles and permits/declines to publish depending on the role of the user. It also updates the users' roles depending on how many nodes they have published.
Users have one role that is relatively fixed with an expiry date, and another role that is dynamic based on the number of nodes published. Whenever roles are updated by rules, the expiry date is cleared.
I'm also using the patch in #5 here: http://drupal.org/node/827594
Comment #41
btown commentedComment #42
stewsnoozeHi @btown
Can you explain this a little more?
Are you saying that the role expiry date vanishes when a user is edited at /user/x/edit/sometab or that when you are using rules the date disappears. Right now the code is setup to only really react to the form being posted, which isn't the best, and when modules call user_save directly they don't always work. I'd love to get more information on this one as it won't die!
Anything you can give me to reproduce such as a feature would be appreciated.
Stew
Comment #43
btown commentedHey Stew,
I'm closing this issue as I've managed to figure out the problem. It was caused by the module "role expiry operations", which we don't really need. I deactivated that module and the problem is resolved.
For reference purposes, the expiry dates were being cleared when one of the admins tried to manually change something on a user account or when one of the admins triggered a rule. I started to figure out the problem when I realized that non-administrators were having no problems with role expiry dates.
I know nothing about the code, but thought it was interesting that Role Expiry Operations caused the problem even when we weren't actually using the module, it was just active in the background.
Let me know if you need any further clarification. Thanks for this great module!
Barry
Comment #44
btown commentedA further update:
Our site uses the LDAP integration module with mixed mode authentication (i.e. some accounts authenticate against LDAP whereas others are local accounts only). When we configured the LDAP Data to be read only, then expiry dates could not be manually entered, and attempts to manually change expiry dates wiped out any dates that had been automatically created by rules.
Even though our LDAP server won't accept updates from Drupal, the LDAP Integration module has to be configured to read/write. This might seem inconsistent with the instructions that come with LDAP Integration, but it seems to work.