Hi, wondering how to go about displaying the membership expire_date from the payments table in a php page? I have successfully displayed data from the members table in a page but have had no luck displaying anything from the payments table. Any ideas? Mark
Mark, you need some PHP programming knowledge to do that. Add the following to very top of your php page: PHP: <?php session_start(); ?> then, where you need to display expiration date, insert the following: PHP: <?php$expire = "---"; // not definedforeach ($_SESSION['_amember_subscriptions'] as $p){ if ($p['completed']) $expire = $p['expire_date'];}print "EXPIRE=" . $expire;?>
Thanks Alex, That worked great! Can I ask how I can display the date in dd/mm/yyyy format? I'd also like to be able to display the type of membership the user is signed up for. Can you tell me the php code for that? Thanks again for your excellent support! Mark
try this PHP: <?php$expire = "---"; // not definedforeach ($_SESSION['_amember_subscriptions'] as $p){ if ($p['completed']) { $expire = $p['expire_date']; }}print "<br>EXPIRE=" . date('d/m/Y', strtotime($expire));$pr_list = $_SESSION['_amember_products'];$pr = $pr_list[count($pr_list)-1]['title'];print "<br>PRODUCT=" . $pr;?>
Hmmm... ... when I converted to Smarty, I get this error: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/xxxxxxxx/public_html/templates_c/%%94^948^948C8F69%%aMember-cheat-sheet.tpl.php on line 124
Solution? I have the same problem, what was the solution? (I'm trying to display expiration on profile.html page).
Fixed problem This is now working for me. There were two things that caused the parse error: 1) When you put the {php} and {/php} around the code, be sure to remove the <?php> and <?> tags. 2) Make sure the php code is properly formatted. My HTML program (Dreamweaver) when I cut&paste the php code to another location in the file put my 'foreach' line on the same line as the tag comment, ie from the example code in an earlier post above: $expire = "---"; // not defined foreach ($_SESSION['_amember_subscriptions'] as $p){ if ($p['completed']) { $expire = $p['expire_date']; } } Make sure the foreach starts on its own line, etc.