[development] Overriding node_db_rewrite_sql()

Dave Cohen drupal at dave-cohen.com
Thu Jul 26 22:28:05 UTC 2007


On Thursday 26 July 2007 10:48, Ron Parker wrote:
[snip]
> So, my question is: Why is this hook_db_rewrite_sql code in a custom
> module creating a circumstance where views no longer work as user #1
> when the same code does NOT create this problem when replacing the
> node_db_rewrite_sql function in the node.module?
>
Sounds like the node.module code is granting access, where your code is not.  
Look for enties with realm 'all' in the node_access table.

> I'm ThisClose to making this all work after several months of banging my
> head against the wall, so any suggestions are much appreciated.  Thanks!

My suggestions are: 1) Install devel module and enable the query log.  Look at 
the exact SQL that is the result of all the rewriting.  And 2) Enable 
devel_node_access and see what it has to say.  And of course 3) debug your 
problem.

I'm also going to reiterate what Moshe said earlier.  Think long and hard 
before implementing your own hook_db_rewrite_sql.  The grant hooks can do 
quite a lot for you.  Sounds like you may know what you're doing - I don't 
mean to imply that you don't.

-Dave




More information about the development mailing list