Jump to content


Photo

how to?


  • Please log in to reply
4 replies to this topic

#1 tauchai

tauchai
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 10 June 2006 - 01:04 AM

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! :)

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 10 June 2006 - 01:12 AM

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.

Info: PHP Manual


#3 tauchai

tauchai
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 10 June 2006 - 02:09 AM

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..

#4 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 10 June 2006 - 04:43 AM

[!--quoteo(post=382116:date=Jun 9 2006, 08:04 PM:name=chai)--][div class=\'quotetop\']QUOTE(chai @ Jun 9 2006, 08:04 PM) View Post[/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!
<script type="text/javascript">
function alertId()
{
document.getElementById("B1").disabled=true
}

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

if($user != admin)
{
\\javascript somehow
}
"Syntax error" .. WHERE THE **** IS IT?!

#5 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 10 June 2006 - 06:54 AM

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:

//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>";
}

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users