uc_roles removes all expiration dates

Project: 
Ubercart
Category: 
bug report
Priority: 
critical
Status: 
fixed

Each time the cron job is executed, all records in uc_roles_expirations table are deleted (except 1 record).

Re: uc_roles removes all expiration dates

It also generates error. Here is what I found from my logs:

in_array() [function.in-array]: Wrong datatype for second argument in /public_html/modules/ubercart/uc_roles/uc_roles.module on line 40

Re: Re: uc_roles removes all expiration dates

This could be similar to the problem I was having. See here:

http://www.ubercart.org/forum/bug_reports/3610/cron_erases_expiration

But as it turns out, several things were conspiring to give me fits. 1. Make sure to update to the latest dev version (see the downloads and then go to the DEV site and get the update from last Friday). 2. Make sure that in your testing that you are not using time zones that may have already expired.

Those are just a few thoughts. I'm sure the developers will have more to say.

Dan

Re: Re: Re: uc_roles removes all expiration dates

Thank you Dan. It's a huge problem for me since my website is already live.
Yesterday I have checked the bazaar and still did not find any updates, so I decided to open this thread. But let me check it again now.

Regarding the timezone, I am not sure it's the problem.
The roles being deleted in my database is set to be expired within a year. Yes, it should be expired by next year. So I do not think timezone problem is the culprit.

Re: Re: Re: Re: uc_roles removes all expiration dates

Cron erasing role expirations in beta 6 was a known issue that should be solved in beta 7. If an update to beta 7 doesn't solve this, let us know.

It worked, but it also generated errors

Shawn, thank you so much.
I have tested the latest revision, and it seemed to work. Except it generated these errors:
"* warning: array_keys() [function.array-keys]: The first argument should be an array in D:\Program Files\Apache Group\Apache\htdocs\shop\modules\ubercart\uc_roles\uc_roles.module on line 41.
* warning: in_array() [function.in-array]: Wrong datatype for second argument in D:\Program Files\Apache Group\Apache\htdocs\shop\modules\ubercart\uc_roles\uc_roles.module on line 41."

Please let me know if you need the sample of my tables.

Re: It worked, but it also generated errors

I wrapped all this code in a check to make sure the user object had a roles array with values in it. Shawn, I'm assuming this code only applies to users with roles... let me know if what I did will screw anything up. Eye-wink

Thank you all...

Okay, I think I should update the latest status.
I have got the latest uc_roles update from the bazaar,
and it works perfectly now. It doesn't generate error anymore.
Thank you all!

Re: Re: It worked, but it also generated errors

Good call Ryan. You're correct on that assessment.

Have the same issue with RC2

All role expirations removed when cron job runs.

Re: Have the same issue with RC2

I can't duplicate the problem with the latest code, so I guess this was fixed after RC2.