#1421 - Being able to show a subscribers expiry date on a comcode page

This is a spacer post for a website comment topic. The content this topic relates to: #1421 - Being able to show a subscribers expiry date on a comcode page
Hi,

The expiry time is put in in sources/support.php, lines 2260-2285. This isn't overridden as we've made the change official for v10.

I was just thinking if we could move it into a symbol or something for you but I think the amount of code structure needed to make it flexible would challenge the amount of code duplicated in a copy&paste job.

So I've pasted it into sources_custom/miniblocks/subscription_expiry.php. You can use that as a block.

I commented line 23 so that it shows the expiry time always.

Line 3 is currently set to that of a specific member, so you can test easily. When tested, put that line back to "$member_id=get_member();".
Hi Chris,

Thanks very much for this.

This only seems to work for subscriptions that are manual and not if they are Paypal.

I would like to show the expiration date for either manual or PayPal.

Does this also mean that the Profile block will only show expiry for Manual Subscriptions.

I tried changing s_via to paypal but that caused a bailout - which I don't fully understand.

I know the information is there becasue adding $all=1 to the subscription tables show them

Cheers
Ade

File -> '/home/vwgolfm/public_html/sources/failure.php'
Line -> 792
Function -> 'die_html_trace'
Args -> array ( 0 => 'PHP ERROR [1] Call to a member function get_products() on a non-object in sources_custom/miniblocks/subscription_expiry.php on line 19 (version: 9.0.5, PHP version: 5.3.20, URL: /index.php?page=membership&redirected=1&redirected=1)', )
File -> '/home/vwgolfm/public_html/sources/global2.php'
Line -> 1011
Function -> '_fatal_exit'
Args -> array ( 0 => 'PHP ERROR [1] Call to a member function get_products() on a non-object in sources_custom/miniblocks/subscription_expiry.php on line 19', )
File -> '/home/vwgolfm/public_html/sources/failure.php'
Line -> 224
Function -> 'fatal_exit'
Args -> array ( 0 => 'PHP ERROR [1] Call to a member function get_products() on a non-object in sources_custom/miniblocks/subscription_expiry.php on line 19', )
File -> '/home/vwgolfm/public_html/sources/global2.php'
Line -> 874
Function -> '_Composr_error_handler'
Args -> array ( 0 => 'error', 1 => 1, 2 => 'Call to a member function get_products() on a non-object', 3 => 'sources_custom/miniblocks/subscription_expiry.php', 4 => 19, )
File -> '/home/vwgolfm/public_html/sources/global2.php'
Line -> 810
Function -> 'Composr_error_handler'
Args -> array ( 0 => 1, 1 => 'Call to a member function get_products() on a non-object', 2 => '/home/vwgolfm/public_html/sources_custom/miniblocks/subscription_expiry.php', 3 => 19, )
Function -> 'catch_fatal_errors'
Args -> array ( )
This should be in a support ticket really, but you did find a bug here. It is assuming the active subscription product still exists, and failing when not. Opening it up wider triggered that, but it wasn't the cause in of itself.

I have fixed that by skipping the subscription display in that case, with this line:
if (is_null($product_obj)) continue;

As I was in the code, I removed the manual limitation, and I put in some extra code to find the renewal time for non-expiring subscriptions...

if ($sub['s_via']!='manual')
{
while ($expiry_time<time()) // Must have auto-renewed
{
$expiry_time=strtotime('+'.strval($s_length).' '.$time_period_units[$s_length_units],$expiry_time);
}
}
As ever Chris you are a gentleman.
0 guests and 0 members have recently viewed this.