When using the Node id argument and passing in the nid of the active node via a default argument, if the node isn't in a menu, the view just displays everything that is in a menu.

I'm filing this as a support request instead of a bug because I'm not sure if this is the intended behavior. It is arising in menu_node_views_arguments_nid.inc in query(). If there's no $pid, I don't think anything should be returned, but right now the code skips over adding any limiting WHERE clause. There's probably a better way to manage that than what's below, but it does the trick.

    else {
      $where = "1 = 0";
      $this->query->add_where(0, $where);
    }

The use case here is a block that displays all the menu items 1 level below the active node. If there's a better way to achieve that instead of the nid argument and default values, maybe this isn't needed.

Sorry for not attaching a proper patch at the moment. If this is determined to be a bug, I will.

Comments

agentrickard’s picture

Category: support » bug

This is likely a bug / oversight.

You could also use the Menu Block module for this, I think.

rjmackay’s picture

Status: Active » Needs review
StatusFileSize
new1007 bytes

I have similar issues. I'm not sure that it tries to display everything in a menu. Rather it tries to display all nodes.
Patch attached

joglin’s picture

D7: works for me!

agentrickard’s picture

@joglin Patches need to be rolled from the module root directory, not your system root.

joglin’s picture

Ok, Sorry. But if this filter in the future will be part of a relationship, this solution will break all Querry!
Right?

agentrickard’s picture

I don't know.

joelpittet’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
Status: Needs review » Needs work

This doesn't seem to apply to D7 from the patch in #5.