Hi,

I am newbie.I have seen projects where there are menus or links below it which are accessible as per the profile set for the logged in users.If there are A,B,C,D menus in project then some group of user will have only A and B Menu when logged in..while other group of users might have A,D or any other elements as per the website elements checked in their assigned profile.Profile might have entire set of fields in projects.Is there any framework or approach or some way through which we can achieve this functionlaity.Thanks in advance. :)

Member Avatar for diafol

THis is a common feature for user groups / permissions. There are a number of scripts out there, but you could always roll your own. All you need is something like the following:

users

id | username | ... | usergroup_id

usergroups

id | label

menuitems

id | label | url | position | parent_id

usergroup_menuitems

usergroup_id | menuitem_id

That's assuming that you're storing the menuitems in a db table.

Otherwise, you can hard-code the visibility of items (not really recommended, but depends on the complexity, e.g. no. of different usertypes etc)

<ul id="nav">
    <?php if($usergroup > 0){ ?>
    <li>someparent</li>
    <?php } ?>
    ...etc...
</ul>

Thanks diafol! Looks like I was on right way.thanks for ur time n reply :) appreciate ur help..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.