Support » Plugin: User Menus - Nav Menu Visibility » version 1.2.6 breaks site

  • Resolved tamerax

    (@tamerax)


    Since the update to the plugin to 1.2.6, my menu doesn’t work correctly and breaks my site.
    Wordpress 5.8
    The7 Theme (latest version)
    Php 7.4

    Disabled and renabled all plugins and it’s definatly this one.
    I think it might be Jquery related but unsure. Had to rollback to 1.2.5 in order to restore site functionality.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    Just as a heads up I have duplicated the issue, though I still can’t see how its happening. In reality I think it was bugged before, and due to non strict comparisons was somehow breaking in a useful way.

    And once we added strict comparisons it caused them to work as initially intended.

    To be honest looking at the original logic, there was no consideration made for hiding children of an excluded parent item. Otherwise it may mean it worked in previous versions of WP and they changed something but I can’t see that.

    Stepping through every changed line now and seeing what is changing the outcome, will keep you posted.

    Plugin Author Daniel Iser

    (@danieliser)

    Lol, I was both right and wrong. v1.2.7 just pushed.

    A) The logic does contain a line to exclude children of an excluded item. Overlooked it before in a sea of red/green diffs.

    B) It was in fact a bug that got fixed, and now is not properly matching.

    
    			$exclude = in_array( $item->menu_item_parent, $excluded );
    

    Was changed to include the strict comparison option which is generally a safer move.

    
    			$exclude = in_array( $item->menu_item_parent, $excluded, true );
    

    In this case $excluded is an array of integers and $item->menu_item_parent is a string which ends up always failing to find a match in the array.

    Changing it to force menu_item_parent to be an int worked.

    
    			$exclude = in_array( (int) $item->menu_item_parent, $excluded, true );
    

    @danieliser,
    i confirm that the issue is fixed in 1.2.7.
    Thank you for giving us some of you time šŸ˜€

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘version 1.2.6 breaks site’ is closed to new replies.