• I just put a groovy login feature on my web site. For that, I am groovy. However, after looking at this line:

    <?php global $user_ID, $user_identity; get_currentuserinfo(); if (!$user_ID): ?>

    I started wondering if I could use something similar to establish the user level of the person visiting my web site. The above script will determine if the user is logged in and, if they are, it displays a menu. Now, I would like to have direct links to posting, managing, etc. The level 5’s would see the links, the level 1’s wouldn’t and so forth.

    Can that be done without using a plugin? Plugins hate me.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Have you tried something like:

    <?php
    global $user_level;
    if ($user_level > 4):
    ?>

    You might want to reconsider, at this point in time, doing anything “fancy” which calls “user_level” or variables based on that, since the next version of WP (which is currently already in beta) doesn’t utilize “user_level” at all….

    Which is true, although at this time the code above works as is on my beta 2 install. Strange, I know…

    (Actually not so strange, as user level is copied over in the upgrade to the new usermeta table, and is still acted upon by some elements in WP.)

    Yes, I too have found a couple of areas wherein it’s still working; my assumption is that anything “new” would probably bork though.

    Thread Starter edyuban

    (@edyuban)

    I don’t really have to worry about that as I’m not planning on upgrading. My code is so randomly modified an upgrade would cause nothing but headaches. The new WordPress would have to be something really special, cleaning my kitchen and yelling at users for their spelling mistakes, etc.

    Do we know if there will be an equivalent method for restrictions available to Admin if user-levels don’t exist?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Menus based on user level’ is closed to new replies.