Forums

[resolved] Conditional menu: if Having_Admin_Rights() (2 posts)

  1. daffulip
    Member
    Posted 5 years ago #

    Sorry for bothering the board, but I can't find the answer (I bet it's there!).

    In the sidebar of a template I want to show a "menu item" if and only if the user is logged in and has administrator rights.

    What is the question that have to ask in the PHP if-statement?

    THX

  2. daffulip
    Member
    Posted 5 years ago #

    Solved it on my own. I am not sure whether this solution is the best, but I did it so:

    <?php global $userdata;
    get_currentuserinfo();
    if ($userdata->user_level == 10) {
    echo('<li>Ciao ' . $userdata->user_login . '</li>');
    echo('<li><a href="http://xxx/wp-admin/post.php">New entry</a></li>');
    echo('<li><a href="http://xxx/wp-admin/page-new.php">New page</a></li>');
    }
    ?>

    Bye!

Topic Closed

This topic has been closed to new replies.

About this Topic