I'm trying to find the hook/module which can modify a views query.

The view is from Workbench module which is displaying the draft's of the actual user.

If I Disable SQL rewriting in the Query settings the display is ok, so something is interfering.

What would be the method to debug?


We can alter a views query using hook_views_query_alter. Try to search in your codebase for this string views_query_alter, you should get a function in one of the custom module which is implementing hook_views_query_alter.

If it doesn't help, try to enable query log using devel module, so you will know what query are being executed for that page. Views also gives the sql query that a particular display will run. See if these two sql queries don't match. You can see the diff and then try to figure out which module might be adding the additional conditions to that query.

  • 1
    See also module_implements() to figure out who is implementing a particular hook. Just remember to pass it the hook name without the "hook_" at the beginning.
    – mpdonadio
    Jun 20 '14 at 18:32
  • Found this commands by the way Drush that I already use: #List implementations of a given hook and explore source of specified one. drush fnh anyhook and #Show the source of specified function or method. drush fnv
    – nilsM
    Jun 24 '14 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.