error in roles assignments and expirations

Posts: 15
Joined: 04/09/2008

Hello guys, first of all thanks a lot for all the hard work. Now I found two problems while trying to set up a site that sells access to several, different restricted areas:

1) same user purchases two restricted areas, and first purchase is completed so user has access to first restricted area. But after initiating second purchase, the first successfully assigned role has disappeared from user's profile (it still shows correctly in his order history).

2) roles are set to expire in 999 years or never, yet user profile shows junk like this: This role will expire on 1970-01-01 02:00

Now I am really rushed to finish the site soon so if anyone has a quick fix please share it ASAP!

Thanks, all the best

Posts: 15
Joined: 04/09/2008

It looks to me now like the problem is one and the same and consists of the wrong expiration. For example I just created a new user who purchased a role set to NEVER expire, but the profile shows: Exipration date 2008-04-09 11:34

So it looks like there is a bug in setting the expiration date right. Any hint as to where in the code to fix this quickly and effectively? Thanks

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hey Roberto, thanks for the report. Lyle and I have been out on separate vacations this past week, but I'll bookmark your thread so I can review the code when I'm back in the office on Monday.

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

Found the problem. In _get_expiration_date(), the first line (1029) is

<?php
 
if (is_null($granularity)) {
?>

but it should be
<?php
 
if (empty($granularity)) {
?>

The granularity for non-expiring roles is an empty string, not null. This is fixed in revision 1053.