Membership "filter" redirect

By Maurice - October 15, 2010

Hi team,

For the Membership pluging i made 6 user levels

1
2
3
4
5
6

i want to redirect a user based on one of levels to a directory

/member/1
/member/2

and so on

how can i do this.

Thnx
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] Membership "filter" redirect

Hi Maurice,

Here's an excerpt from my CMSB Cookbook thecmsbcookbook.com that might help.

1) In your user accounts editor, create a multi value list field called allowedFolders
The values I used are:
board_access
committee_access
general_access

Go into the User Accounts list and check some values in your account to authorize access to some of those folders.

2) In the root directory of your site create 3 folders:
board_access
committee_access
general_access

3) In each folder upload a test file called access.php

the code in each of the access.php files is:

<?php
require_once "../cmsAdmin/lib/viewer_functions.php";
if (!@$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN']) { die("You must activate the Website Membership plugin before you can access this page."); }
if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); }

//
$folderName = basename(dirname(__FILE__));
$allowAccess = preg_match("/\t$folderName\t/", $CURRENT_USER['allowedFolders']);
if (!$allowAccess) { die("You don't have access to this folder!"); }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Access Test</title>
</head>

<body>
<?php echo $CURRENT_USER['allowedFolders'] ?>
</body>
</html>

The code in the body just prints out the directories that the particular member is authorized to view.

After you’ve got the basic code working, you can paste the code required into an existing page, upload it to one of those directories, and make sure it all works as planned.
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Membership "filter" redirect

By Maurice - October 18, 2010

Great thnx if thats in the cook book i will buy it [;)]

but i just want a simple redirect to a directory or file after that it dos not matter any more witch directory they will enter.

but thnx
-------------------------------------------

Dropmonkey.nl

Re: [gkornbluth] Membership "filter" redirect

By Maurice - October 18, 2010

oke thanx
-------------------------------------------

Dropmonkey.nl