Membership Plugin Question

14 posts by 2 authors in: Forums > CMS Builder
Last Post: September 12, 2012   (RSS)

By meg - September 7, 2012

I know there's a way to restrict users from certain areas by selecting access "by section" in the User Account preferences. However, is there a way for a member to login and have them go to a specific page based on their membership level, instead of just a homepage for all members?

Re: [meg] Membership Plugin Question

By Jason - September 10, 2012

Hi Meg,

No problem. The way I normally set this up is to have the plugin redirect all users to a single "launching" page. All this page does is figure out what user level they are and redirects them.

EXAMPLE:

if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); exit; }

$url = "";

if ($CURRENT_USER['user_type'] == 1) {
$url = "profile.php";
}
elseif ($CURRENT_USER['user_type'] == 2) {
$url = "admin.php";
}
else {
$url = "homepage.php";
}

redirectBrowserToURL($url);
exit;


In this example, if "user_type" was 1, they are redirected to profile.php. If its 2, they're redirected to admin.php. If they have anything else, they get sent to homepage.php.

Hope this helps get you started
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Plugin Question

By meg - September 10, 2012

How do I designate a user type in each account?

Re: [meg] Membership Plugin Question

By Jason - September 10, 2012

Hi,

You can create a field called "user_type" in the accounts section and give a value to each user.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Plugin Question

By meg - September 10, 2012

Sweet - I didn't realize you could do that. Thanks for the tips!![;)]

Re: [Jason] Membership Plugin Question

By meg - September 10, 2012

Just confirming, you place that code within the user-login.php file?

Re: [meg] Membership Plugin Question

By Jason - September 10, 2012

Hi Meg,

What you would do is create a separate PHP file (example: launchPage.php) and you would set this page in your website membership plugin:

example:

$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = 'launchPage.php';

So everyone, after they login, will get redirected to this page. then this page will redirect them again, based on their user type.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [meg] Membership Plugin Question

By Jason - September 12, 2012

Hi meg,

Sorry, it looks like your file didn't get attached. could you please repost this?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Plugin Question

By meg - September 12, 2012

here you go.
Attachments:

launch.php 1K