• Resolved TC

    (@thamescareers)


    Hello and many thanks for a great plugin.

    Currently, I am using the Login/Register and Logout/Edit profile links in the main menu as provided for in the plugin. I was wondering if there was a way to reassign these links to a different menu. I have an ‘above menu’ where I would like to place them.

    I know I can add them to all menus and then perhaps hide them, but it would be neat to assign them specifically to the above menu. I am comfortable with adding functions and editing code, so if there is a handy way of doing this that would be super.

    Many thanks for your time.

    • This topic was modified 4 years, 11 months ago by TC.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Robin W

    (@robin-w)

    not one I had thought of !

    I might add that capability, but in the meantime, can you just try this in your child theme’s function file and change the name from primary.

    remove_filter( 'wp_nav_menu_items', 'bsp_nav_menu_login_link' , 10, 2);
    add_filter( 'wp_nav_menu_items', 'rew_nav_menu_login_link' , 10, 2);
    
    function rew_nav_menu_login_link($menu, $args) {
    	
    	global $bsp_login ;
    	//**********change primary below to the name of your menu
    	if ($args->theme_location == 'primary' )   {
    		elseif (!empty ($bsp_login['only_bbpress'] )) {
    		if(is_bbpress()) {
    		$loginlink = bsp_login() ;
    		}
    		else {
    		$loginlink="" ;
    		}
    		}
    		
    		else {
    		$loginlink = bsp_login();
    		}
    			$menu = $menu . $loginlink ;
    	return apply_filters( 'rew_nav_menu_login_link', $menu );
    	}
           	
    }

    This just does login – if it works, I’ll look at in detail

    Thread Starter TC

    (@thamescareers)

    Hi Robin W

    Thank you for putting something together. I have tried the code as instructed but keep getting a critical error. I notice some of the syntax checkers don’t like that first elseif, so I’m not sure if that’s the issue.

    Best,

    Plugin Author Robin W

    (@robin-w)

    no problem, I just shoved some code together – I’ll take a better look later and come back to you!

    Thread Starter TC

    (@thamescareers)

    Awesome, thanks!

    Plugin Author Robin W

    (@robin-w)

    ok, I’ve just released 4.4.8 which should have the capability you want.

    After updating, navigate to login, and you should see that you can now choose which menu’s the items appear in.

    Please do let me know that it is working, or what needs correcting

    Thread Starter TC

    (@thamescareers)

    Hi Robin

    Brilliant! Thank you so much. The new features are working perfectly as far as I have tested them:

    • Moved Login/Logout and Register/Edit Menu links from main menu to top menu – check
    • Added existing CSS classes – check
    • Changed the name from ‘Edit Profile’ to ‘Profile’ – check

    Your expertise and plugin are much appreciated.

    Best,

    • This reply was modified 4 years, 11 months ago by TC.
    Plugin Author Robin W

    (@robin-w)

    hey great – thanks for the feedback, and thanks for helping improve my plugin !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Assign Login/Register and Logout/Edit Links to Another Menu’ is closed to new replies.