Support » Plugin: Login Logout Menu » [Plugin: BAW Login Logout Menu] Null object reference at bawllm.php, line 40

  • Resolved nguyenvuduc


    I found this bug after turned on WP_DEBUG.
    If we add Register menu item into navigation menu, and login, WordPress will throw this bug.

    It is because the statement at line 40 refer to $item object
    $item->url = site_url( ‘wp-login.php?action=register’, ‘login’ );
    which has been set to null before.

    Beside, return null from filter of wp_setup_nav_menu_item is illegal.

    Thank you for creating this plugin. It is great.

Viewing 9 replies - 1 through 9 (of 9 total)
  • So this is the cause of the empty tag ‘bug’?

    It would be awesome if that get’s fixed. I ‘fixed’ it by hiding the white border with css.

    Besides this minor problem, this is an awesome plugin!

    Plugin Author Julio Potier


    Thank you both of you, sorry for the delay nguyen.
    I’ll try to really fix this asap
    See you !

    Hi there, this plugin is great except this bug mentioned above. Do you have any +/- date when can we expect fix for this bug?

    Hello everyone, as regard the issue above, have fix it in a simple way and I would like to share it with you all.
    1- Add ‘Register’ Menu on your Header or anywhere you want to put it, you might have error after refreshing, don’t worry.

    2- Go to the plugin directory of your ‘baw-login-logout-menu’ folder and open ‘bawllm.php’ with any editor of your choice.

    3- Now go to line 38 of the bawllm.php

    4- Change this line of code:
    case ‘#bawregister#’ : if( is_user_logged_in() ) $item = null; else $item->url = site_url( ‘wp-login.php?action=register’, ‘login’ );

    4b- Change the above code and replace it with this:
    case ‘#bawregister#’ : if( is_user_logged_in() ) $item->url = site_url(); else $item->url = site_url( ‘wp-login.php?action=register’, ‘login’ );

    That will fix it perfectly.


    Kudos to the creator of this plugin.

    Plugin Author Julio Potier



    I’m on it right now, sorry for the delay.
    Your solution is not correcte, sorry. A entry menu is created but i don’t want one because i’m logged in!
    What’s your href link result with this !? Is it “correct” and attended ?
    Thanks by the way

    Plugin Author Julio Potier


    Ok this is now patched, i’ll send the update in the next hour.

    Plugin Author Julio Potier


    1.3.2 is out, this is tested and fixed!

    For you information i did this:

    $item = null;
    $item->title = '#bawregister#';

    and added this:

    add_filter( 'wp_nav_menu_objects', 'bawllm_wp_nav_menu_objects' );
    function bawllm_wp_nav_menu_objects( $sorted_menu_items )
    	foreach( $sorted_menu_items as $k=>$item )
    		if( $item->title==$item->url && $item->title=='#bawregister#' )
    			unset( $sorted_menu_items[$k] );
    	return $sorted_menu_items;

    So i correctly delete the menu entry 😉

    Julio, for me it serve the purpose but anyway will check out your update though.


    Good work Julio, its cool, have check it out nice one.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: BAW Login Logout Menu] Null object reference at bawllm.php, line 40’ is closed to new replies.