I'm creating a subscriptions website and using the AAR project to offer the user two roles on registration (one with a 30 day expiry attached)
http://drupal.org/project/autoassignrole

It seems that the expiry date is not being set during registration as expected

Similar to this issue (I think):

Role expiration isn't set during admin user add/create, only during edit.
http://drupal.org/node/608312

Comments

stewsnooze’s picture

Status: Active » Postponed (maintainer needs more info)

This is potentially quite simple. What is the weight of the AAR module in relation to Role Expire. I think AAR should probably be of a lower weight so that it runs first in hook_user() Can you try that before I dig into the AAR code?

Bobuido’s picture

Status: Postponed (maintainer needs more info) » Active

Hi stewsnooze

Thanks for such a quick reply

Unfortunately changing the weights of the modules didn't seem to help

I set AAR to -5 and Role Expire to 5 and still no joy - There's nothing I have to flush for the weights to take effect right?

The role is assigned but an expiry date is not set (only when I remove and re-apply the role)

natoya’s picture

Version: 6.x-1.9 » 6.x-1.x-dev

Hi!
Thanks for this amazing module.

I'm also having the same problem, when the role is assigned by the AutoAssign role module, the register in the DB is not added. How can we solve this?

Regards,
Natalia

tjb74’s picture

subscribing

jalane81’s picture

Same problem here. Any luck solving this yet?

stewsnooze’s picture

Status: Active » Postponed (maintainer needs more info)

I *think* this might be because role_expire doesn't have a case: 'register'

Does anyone have this combination installed before I spin up a new install to debug?

Can you try creating a user as an administrator, which will call case: 'insert' and see whether the role gets an expiry date. That will basically prove to me that role expire is missing case: 'register' which should be a simple fix

jenniferannwalsh’s picture

Hi Stewart,

I just tested this out on a site with both role expire and auto assign role. I created a new user using the admin interface. I left the role expiration field that appeared blank. The new user was created with the default role expiration.

I too am attempting to create a user registration page with auto assign role that assigns a particular role with the default role expiration. Roles are getting assigned fine but with no expiration.

Tried creating a rule to assign the expiration after the fact but have not gotten that to work yet.

Happy to help test.

Jen

jenniferannwalsh’s picture

Status: Postponed (maintainer needs more info) » Active

Just changing the status. Hope I got it right!

stewsnooze’s picture

Ok that proves it. We should add the register case to role_expire_user. I'm not sure whether it can just piggy back on insert: and update: or whether it needs separate code

jenniferannwalsh’s picture

Glad I could do something to help. Wish I could help with code but I'm only good for testing. I'll stay tuned to this thread for requests to test.

jenniferannwalsh’s picture

One other thing I noticed from a previous issue is that if a role is applied to an existing user by Rules the default expiration is not set. This was easy to remedy by adding another 'Do' to the rule to add the role expiration. Not sure if this is related or not but thought it was worth mentioning.

cham74’s picture

subscribing...

cham74’s picture

Has any work around for this been made? We have several sites where we are creating several roles and need this function on sign up. We are having to manually remove the role and reapply it on the day of sign up, or manually edit the profile page of each new subscriber.

agalvez’s picture

I have the same problem too.

ReneHansenM’s picture

Same problem here.
Any news, this issue seems to have been around for a while? No posts since January either.

We have tried different approaches to get a role with expire date set on user self registration:
Using Registration role module. Role is set ok, but no default expire date.
Using Auto Assign Role module as described above. Role is set ok, but still no default expire date.

Setting up rules to assign the role AND setting the expire date. Role is set ok, but still no expire date.

The same problem using UC recurring fees to assign roles. Role is set ok, but still no default expire date.

Otherwise Role Expire is a very useful module, thank you for that. We are even using this patch, http://drupal.org/node/827594 #5, though it has not been committed as yet. It works like a charm.

Its sad though that Role Expire needs so much manual intervention to get the expire date set correctly.

René

stewsnooze’s picture

I have a week off next week. I'll take a look then. is that ok?

ReneHansenM’s picture

That will be super.

Thanks a lot.

René

ReneHansenM’s picture

Hi again Stewart,

I actually found a workaround, at least for the assigning of a 30 day trail membership to new users.

Instead of using the earlier mentioned role assign modules I simply make a rule as follow:
Rule:
__New User 30 Days.
Rule elements:
__ON event User account has been created

__DO
____Add user role
______User whos roles should be changed: registered user
______Select role(s): 30 days trail
______Weight: 0

____Add expire time to role
______The user which the expiration time will be added: registered user
______Role: 30 days trail
______Expiration time: 30 days
______Weight: 5

If you use acting user instead of registered user it won't work.
This is of cause not an optimal solution as its not the default expire time already set on the role which is assigned, which is also easier maintainable, but it works and will spare us lots of work correcting the expire date on every new user.

Now I just need to figure out if I can make similar rules setup for UC events. UC recurring fees module already has build in revoke and assign roles, but its not working with Role Expire as said earlier. Also the e-mail on, about to expire, is not a function in UC recurring fees, but that function we have very neatly in Role Expire, due to the patch mentioned earlier, which is why we need Role Expire.

René

sharplesa’s picture

Status: Active » Needs review

I've just posted a patch over at #649256: Default expiration when creating new users - http://drupal.org/node/649256#comment-5291110. Does the new behavior from the patch over there simplify this? Please test and comment here.

rcodina’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Drupal 6 version is unsupported!