Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Using bbPress and s2Member, I need to hide the registration link in the menu for logged in users and the members directory link for non logged in users.

share|improve this question

put on hold as off-topic by Pieter Goosen, toscho Jul 19 at 6:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer 1

A simple way to achieve that is to create two separate Navigation Menus (/wp-admin/nav-menus.php), and in your theme use the following:

// Reference:
// http://codex.wordpress.org/Function_Reference/is_user_logged_in
// http://codex.wordpress.org/Function_Reference/wp_nav_menu

if( is_user_logged_in() ) {
    wp_nav_menu( array( 'theme_location' => 'logged-users' ) );
} else {
    wp_nav_menu( array( 'theme_location' => 'not-logged-users' ) );
}

Instead of theme_location, you can use the menu name directly, check the documentation for wp_nav_menu.
And you'd probably would like to use the function is_user_logged_in in the template files for the Registration and Directory pages.

share|improve this answer
    
Thanks but no template files for the registration and template file. Can i use this code in the child themes functions.php? I'm using a Genesis child theme. i guess i can use the primary and secondary menu's in the same location? –  Brad Dalton Mar 15 '13 at 9:00
    
<code>add_action( 'genesis_after_header', 'genesis_do_nav' ); function genesis_do_nav () { if( is_user_logged_in() ) { wp_nav_menu( array( 'logged-in' => 'logged-users' ) ); } else { wp_nav_menu( array( 'logged-out' => 'not-logged-users' ) ); },</code> –  Brad Dalton Mar 15 '13 at 9:13
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.