I am working on a trial version of the script at the moment for an insight into what amember can do before setting up for a client. The question is this: How would i go about setting up some sort of countdown to expiration date. Something like - Your subscription ends in ** Days. Would love to see this also available as a mod to show on a non amember page as has been done with the login form. Thankyou for looking
My members cannot have multiple subscriptions, so how could it be done for single subscription. Any ideas are welcomed.
PHP: <?phpsession_start();foreach ($_SESSION['_amember_subscriptions'] as $sub) ;if ($sub['payment_id']){ $diff = (strtotime($s['expire_date']) - time()) / (3600*24); if ($diff > 0){ print "Your subscription expires in $diff days"; }}?>
Code: Warning: Invalid argument supplied for foreach() I am trying to display on a none amember page. Would this be the problem? Thanks though
Thanks, I am fairly new to php and finding it very interesting. I asked the following question elsewhere and this was the result. I ran this code, and the outcome was false. Code: var_dump(is_array($_SESSION['_amember_subscriptions'])); if you have bool (true), it is an array, false mean it is not. Any help is greatly appreciated. I have lost my hair trying to get this to run!
This will list all current subscriptions for a user, the database stuff is you prefix (ie amember_ or your DB abd prefix ie my_db.amember_) you must have already created a mysql connection. Code: function Get_aMember_Subscriptions( $member, $Database_Details ) { $sql = "SELECT member_id FROM {$Database_Details}members WHERE login='{$member}'"; $result = mysql_query( $sql ); if( $result === false ) { die( "mySQL Error Query failed" ); } $user = mysql_fetch_array( $result ); if( $result === false ) { die( "mySQL Error :: No user" ); } $sql = "SELECT * FROM {$Database_Details}payments WHERE member_id = {$user[ 'member_id' ]} AND begin_date <= NOW() AND expire_date >= NOW() AND completed > 0 ORDER BY product_id "; $result = mysql_query( $sql ); if( $result === false ) { die( "mySQL Error Query failed" ); } $prods = array(); if( mysql_num_rows( $result ) == 0 ) { return( prods ); } while( $prod = mysql_fetch_array( $result ) ) { $prods[] = $prod; } return( $prods ); } You can then select the product you want and display information for that one as you wish. If you want a specific version for your site ready to roll I will do it for US$25. Larry