[resolved] $user_level for admin account returned as 0? (3 posts)

  1. SteelFrog
    Posted 6 years ago #

    Hey there, folks.

    I'm trying to write a short condition-based sidebar menu for my blog. I'm trying to add a few options only available to user accounts level 1 and up. While it works fine for all other accounts, my admin account returns a value of 0 when I call $user_level.

    Here's how I get the value:
    <?php global $user_ID, $user_email, $user_identity, $user_level; ?>

    I then use that value here:
    <?php if ( $user_level >= 1 ) : ?>

    I checked the user_level by doing a simple print. Any ideas why the admin account returns as 0 rather than 9 (or is it 10?)

  2. t31os
    Posted 6 years ago #

    Levels are for backwards compat, determine the role instead.

    The approach here would be easy to adopt.

  3. SteelFrog
    Posted 6 years ago #

    Thank you! I knew this had changed but I couldn't find any proper documentation on it. Appreciate the help!

Topic Closed

This topic has been closed to new replies.

About this Topic