
Jason
Staff
/ Moderator

Jul 8, 2011, 9:46 AM
Post #2 of 3
(812 views)
Shortcut
|
|
Re: [cKopyar] Website Membership Plugin - Restrict Access based on Access Level
[In reply to]
|
Can't Post
|
|
Hi, There are a couple of ways of doing this depending on how you are setting up your user levels. If you're using the section access list inside the accounts section, here are a couple of things you can check for inside the $CURRENT_USER array. You can check the "isAdmin" field to see if they have administrative access and take action if they don't:
<?php if (!$CURRENT_USER['isAdmin']): ?> .. code for what to do if they are not an admin. <?php end if ?> If you want to check to other user levels, you can look at the 'accessList' field. This is an array inside the $CURRENT_USER variable that uses the name of the section as a key and has a field called "accessLevel" which stores a number. For example, if you're checking to see if a user has editor access to all sections, and take action if they don't, you can try this:
<?php if ($CURRENT_USER['accessList']['all']['accessLevel'] != 9): ?> .. code for what to do if the user doesn't have editor access to "all" sections. <?php endif ?> For accessLevel, none = 0, author = 6, and editor = 9 Hope this helps get you started. Let me know if you have any other questions. --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|