#1421 - Being able to show a subscribers expiry date on a comcode page
| Identifier | #1421 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Being able to show a subscribers expiry date on a comcode page |
| Status | Closed (no changes needed) |
| Handling member | Chris Graham |
| Addon | General / Uncategorised |
| Description | Hi Chris,
This may be a new feature, or it might already be there and I just need a couple of nudges in the right direction !! Do you remember coding up the custom manual subscriptions stuff ? Well, you can see the expiry date of the members subscription in their side stats profile block from a week before expiry. You can also see the same information in the eCommerce area if &all=1 is added to the query. I would like to add the expiry date date to a comcode page based on the user that is logged on. Looking in the BLOCK_SIDE_PERSONAL_STATS.tpl I can see that the information is written out in {DETAILS}: {+START,IF_NON_EMPTY,{DETAILS}} <ul class="compact_list"> {DETAILS} </ul> {+END} So I expected to find a sources_custom side_personal_stats.php but there is not one. So what populates the {DETAILS} section ? And could I reuse some of it on a comcode page ? Cheers Ade |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
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();".
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 ( )
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);
}
}