is there a way to know witch module is responsible to programmatically alter a view's query? I have a view that diplays some orders with a filter by current user if he is owner of the order or not ..

If the current user is admin, i can see my orders with no problems.
If im logged in with another role the view is always empty althought im ordering products with that user.

I doubt about the view access, or some modules permission (for example if this role has the permission to view his own orders or if he has permission to view his own product ...) I checked these permissions carefully, but the view result still empty.

when I debug the query I get inside where clause an additional condition that's applyed only for non admin users :


  (AND 1 = 0)


as you know this condition returns always false, so that's why the result of the query is empty.

Is there a way to know from where is coming this condition when im logged in with a non admin role ?

Thanks in advance.
Interesting question / challenge, not obvious to debug ...
Here is what I would do, in the order specified:

Scan the entire modules directory for a string containing '1 = 0'.

Scan the Drupal database (all tables) for a string containing '1 = 0'.


If none of both scans lead to any results, I'd consider using the X-ray module, to check if that would help me any further. Some details about this module (from its project page):

X-ray module gives a look at the skeletal structure of a site to help developers and site builders see how things work.
X-ray Features:

A technical summary is added to the help above the main administrative sections. For example, blocks, content types, and menus are summarized on Structure; themes on Appearance; etc.
A table of permission titles matched to their permission machine names.
A table of most* hooks which Drupal invokes (and when they are invoked) and that are available to be implemented.
The function and arguments producing each page you visit, displayed on that page.
The form ID of every form you see, displayed on the form.