PHP Scripts Development » PHP Classes Support Forum » Access_user Class Support forum

access_user: functions based on user level

(5 posts)

Tags:

Great offers not only for geeks!


  1. User has not uploaded an avatar

    robj
    Member

    I recently downloaded the access_user_class and it works pretty well. The question I have is how to go about generating an if statement that would show different content based on user level.

    Example Code:

    if(access_page($level) > 5) {
       echo "<div>You're above level 5</div>";
    } else {
       echo "<div>You're below level 5</div>";
    }

    Thanks for the help.
    rob

    Posted 4 months ago #
  2. You can use it this way:

    $obj = new Access_user;
    if ($obj->get_access_level() > 5) {
       echo "<div>You're above level 5</div>";
    } else {
       echo "<div>You're below level 5</div>";
    }
    Posted 4 months ago #
  3. User has not uploaded an avatar

    robj
    Member

    Perfect. Thanks for the quick response.

    rob

    Posted 4 months ago #
  4. User has not uploaded an avatar

    mfoland01
    Member

    How would I make certain links or functions show with the level if they have it, and name levels in their profile (like Administration, etc)?

    Posted 4 months ago #
  5. Quote from: mfoland01
    "How would I make certain links or functions show with the level if they have it, and name levels in their profile (like Administration, etc)?"

    The levels are numeric, sure you can name them: 1 = guest, 2 = normal user, ...

    show links depending on the user level the same way as my example above

    Posted 4 months ago #

RSS feed for this topic

Reply

You must log in to post.