Jump to content

Archived

This topic is now archived and is closed to further replies.

tauchai

how to?

Recommended Posts

I don have idea to disable some of the menu on the topbar...meaning normal user should not able to access to the menu item...only for administrator. But How to disable it or gray the button out so that is notclicakbe for normal user?

is it need Javascript or wat?

plz help.

thxs a lot! :)

Share this post


Link to post
Share on other sites
All depends on how you set it up. The normal ways it to have different levels for different members. If the user is above a certain level, show them the link, if they're not, hide it.

Share this post


Link to post
Share on other sites
i mean if there is any coding to disable the button or gray it out which is easiet way...assigning different access level is ok..but the view/menu item for the normal user is just little..just 1 or 2..so it is better for me to gray it out and all user share all menu item, with normal user,some menu item is not accessible by gray out or disable the button..

Share this post


Link to post
Share on other sites
[!--quoteo(post=382116:date=Jun 9 2006, 08:04 PM:name=chai)--][div class=\'quotetop\']QUOTE(chai @ Jun 9 2006, 08:04 PM) [snapback]382116[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I don have idea to disable some of the menu on the topbar...meaning normal user should not able to access to the menu item...only for administrator. But How to disable it or gray the button out so that is notclicakbe for normal user?

is it need Javascript or wat?

plz help.

thxs a lot! :)
[/quote]

to make it gray out you need javascript something like this!
[code]<script type="text/javascript">
function alertId()
{
document.getElementById("B1").disabled=true
}[/code]

to make it if its not the admin do something like this

if($user != admin)
{
\\javascript somehow
}

Share this post


Link to post
Share on other sites
yes, that will work..up until the user decides to disable javascript.

you need to make a condition based on the user's level, and echo the link either as a link if admin level, or else a gray font color plain text for the user.

how you would actually go about implementing this depends entirely on how the rest of your code is setup. but basically it would look something like this:

[code]
//at some point in time before this, you would establish
//$user_level as the user's level. let's say for argument's
//sake level 1 is user, and level 2 is admin

if ($user_level == 2) {
  echo "<a href='blah.php'>blah</a>";
} else {
  echo "<font color='gray'>blah</font>";
}
[/code]

Share this post


Link to post
Share on other sites

×

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.