dazed and confused - membership
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: January 26, 2017 (RSS)
I want Logged in users to have access to different pages depending on the option checked in their User Account - in this case a Basic Member will have access to only a Basic Member page (memberbasic.php) and a Preferred Member will have access to only a Preferred Member (whiteoak.php) page.
I added this code to both the basic and preferred member pages:
<?php require_once "cmsb/lib/viewer_functions.php"; ?>
<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>
But I can't figure out how to restrict Basic Members from the Preferred Members page. If a basic user tries to access the preferred page I'd like to redirect him to the basic page.
Thanks.
By ross - January 26, 2017
Hi there.
Thanks for posting.
What I think you are going to need is something like this:
<?php require_once "cmsb/lib/viewer_functions.php"; ?>
<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>
<?php if ($CURRENT_USER['basic_member']) { header("Location: basicpage.php"); } ?>
?php if ($CURRENT_USER['preferred_member']) { header("Location: whiteoak.php"); } ?>
Notice that I've marked in red where your field names go. Make sure to update these if you are using different names.
There may also be some other tweaks required depending on your setup.
Give it a shot and let me know any questions.
Thanks!
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/