The current script setup redirects the user when they are not in the correct membership group to view the page when using: <?php include("../members/library/Am/Lite.php"); Am_Lite::getInstance()->checkAccess(2); ?> I would like to echo an error message instead of redirecting the user to another page, is this possible by editing this code? i have tried : <?php include("../members/library/Am/Lite.php"); ?> <?php if (Am_Lite::getInstance()->checkAccess(2)); ?> Not permitted to view <?php else: ?> <?php content ?> but this does not work. Thanks
For anyone interested, i got it working with the following: <?php include("../../members/library/Am/Lite.php"); $membership=Am_Lite::getInstance()->haveSubscriptions(2); ?> <?php if($membership >=1):?> Protected Content ?> <?php else : ?> Upgrade to view content <?php endif; ?> haveSubscriptions should be the number of the membership you want to check the user has It then checks if their number of memberships in group "2" is 1 or higher.
Further improvement displays different messages (can be changed to different html or code) depending if user is subscribed, logged in but not subscribed, and not logged in. <?php include("../members/library/Am/Lite.php"); $membership=Am_Lite::getInstance()->haveSubscriptions(2);; $isloggedin=Am_Lite::getInstance()->isLoggedIn(); ?> <?php if($membership >=1):?> You have a valid membership <?php elseif($isloggedin >=1):?> You need to upgrade <?php else:?> please login <?php endif; ?>