Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Subs

ron_s's picture
Offline
Joined: 09/11/2008
Juice: 173
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Subs

I don't have time to research this any more at the moment, but here is some more information.

The problem is associated with the uc_roles_order function in the uc_roles.module file. What happens with a new order is it first completes the "else" part of the "if (!is_null($existing_role->expiration))" conditional, to grant a user the role for a given amount of time.

Then shortly thereafter, the uc_roles_order function is run again, this time the "if (!is_null($existing_role->expiration))" part of the conditional. This renews the expiration time on the order, effectively doubling the role expiration length.

What doesn't make sense is it seems as though the uc_roles_order function is being called twice. I would have expected it is only being called once as the order is set to "Completed". However when I look at the Order Log, maybe this has something to do with it:

Sun, 11/23/2008 - 09:17 2923 Order status changed from In checkout to Completed.
Sun, 11/23/2008 - 09:17 2923 Order status changed from Completed to Completed.

Seems like maybe the hook_order is being fired twice, once for "In checkout to Completed", and a second for "Completed to Completed". If this is the case, then it might be that it runs through uc_roles_order a second time. Since the expiration date is already set, it automatically is going to treat it as a renewal and add the time to the end of the role expiration.

Expiring roles and recurring fees for subscriptions By: ron_s (53 replies) Sat, 10/04/2008 - 02:50