Forums

Changing menu items according to user level (3 posts)

  1. stvharman
    Member
    Posted 1 year ago #

    Hello -
    In WP 3.0.1, I would like to show different menu items in the menu bar if a user is logged in. The public users and logged in users should have different items available to them. How can I accomplish this?

    Thanks in advance,

    Steve.

  2. Andrea Tarantini
    Member
    Posted 1 year ago #

    Hi Steve,

    that feature is coming with Menubar 4.8, when you will be able to generate a menu link with PHP code, e.g.

    $some_url = some expression;
    $other_url = other expression;
    
    if (some-condition)
    return $some_url;
    else if (other-condition)
    return $other_url;
    else
    return '';

    If you return an empty value, no menu item will be generated.
    Please stay tuned!

    PS: if you need to implement that feature with Menubar 4.7, you could create two different menus, and show only one of them putting this PHP code in your theme:

    if (condition)
    do_action('wp_menubar','firstmenu');
    else
    do_action('wp_menubar','secondmenu');
  3. Andrea Tarantini
    Member
    Posted 1 year ago #

    Hi Steve,

    Menubar 4.8 is now available, you can give it a try!

Topic Closed

This topic has been closed to new replies.

About this Topic