Jump to content

CMS menu rights for users


manishrestha529

Recommended Posts

the way i do it is add a field to database table called access_level

 

in my case I need to control 2 things .. page view and page content items (menu links in your case).

 

I wrote 2 functions ..

1. can_i_be_here($allowed_levels)

this function checks the allowed levels to see if the users access_level is allow to view. if not it redirects to the previous page.

 

2. can_i_see_this($allowed_levels)

this function checks to see if the users access_level is allowed to see the item in question. it just returns true or false.

 

i use them like this

if(can_i_be_here('5|9'))
{
run code and display content.

}

 

 

and

 

if(can_i_see_this('2|9'))
{
    echo 'this is my content only you can see';
}

 

this is a very basic explanation, but it should get you pointed in the right direction.

 

hope it helps.

Link to comment
Share on other sites

I got you! But can't i do it in this process?

-> Create 'menus' table in database which has 'id, menu_name, link' as fields.

-> Then, create 'menu_rights' table in database which has 'menu_id, user_id' as fields.

-> Then, create relationships between these two tables.

 

But i can't do so.... :(

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.