tauchai Posted June 10, 2006 Share Posted June 10, 2006 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 Link to comment https://forums.phpfreaks.com/topic/11628-how-to/ Share on other sites More sharing options...
ober Posted June 10, 2006 Share Posted June 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43903 Share on other sites More sharing options...
tauchai Posted June 10, 2006 Author Share Posted June 10, 2006 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.. Quote Link to comment https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43911 Share on other sites More sharing options...
legohead6 Posted June 10, 2006 Share Posted June 10, 2006 [!--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 thisif($user != admin){\\javascript somehow} Quote Link to comment https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43924 Share on other sites More sharing options...
.josh Posted June 10, 2006 Share Posted June 10, 2006 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 adminif ($user_level == 2) { echo "<a href='blah.php'>blah</a>";} else { echo "<font color='gray'>blah</font>";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11628-how-to/#findComment-43939 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.