Results 1 to 8 of 8
  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default Hiding stuff in PHP?

    Hello,

    I have a Navigation menu and I am using the Techtuts user system (I know, I know its ****! but Im going to improve it, its just a baseline...).

    How do I hide the Admin part of my Menu in my Navigation?

    Thanks
    Tom
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Nov 2006
    Location
    Leeds, Yorkshire
    Posts
    992
    Tokens
    0

    Default

    if the user-level is admin then display the link.
    don't know the code for techtuts system so can't post sorry.


  3. #3
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    if($usergroup "admin"){
    print(
    "Admin bit");

    Change variables and it will work
    Last edited by Luckyrare; 05-12-2006 at 06:39 PM.

  4. #4
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    The database uses 'id' for user levels so would it be:
    PHP Code:
    if($id "5"){
    print(
    "Admin menu blah blah!");

    Last edited by Recursion; 05-12-2006 at 06:41 PM.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  5. #5
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    You're using the wrong operator, it should be "==" rather than "=" to compare stuff.
    kinda quit.

  6. #6
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    so:

    PHP Code:
    if($id == "5"){
    print(
    "Admin menu blah blah!");

    ?
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  7. #7
    Join Date
    Nov 2006
    Location
    Manchester, UK
    Posts
    42
    Tokens
    0

    Default

    It actually uses 'level', the ID is the member number if you like. Use

    PHP Code:
    <?
    ob_start
    ();
    include(
    "config.php");
    if (
    $logged[username]) { echo ("Members Stuff"); }
    if (
    $logged[level] == "5") { echo ("Admin stuff"); }
    ?>
    Last edited by San$; 05-12-2006 at 08:00 PM.

  8. #8
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Oh yes, it is Level.

    San, I like your code as it has members and admins. This will be used in my 1st DJ Panel (being made to help me learn PHP). I could also use your code to make it have an integrated news system so i could have news reporters that are non DJ.

    Thanks for that San
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •