Website Membership Plugin - Restrict Access based on Access Level

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 10, 2011   (RSS)

Re: [cKopyar] Website Membership Plugin - Restrict Access based on Access Level

By Jason - July 8, 2011

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 - Project Manager
interactivetools.com

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

Re: [Jason] Website Membership Plugin - Restrict Access based on Access Level

By (Deleted User) - July 10, 2011

I was able to get this working. Thanks