This entire effort is to that end. I have written my own hook_db_rewrite_sql. I have tested it *in* the node module, and am now trying to put it into a separate module, and the node module back to it's original code.You should write your own hook_db_rewrite_sql and not muck with what's in node.module. You should not have to muck with it.
I understand this perfectly. But, if I create a group view, and as user #1 look at that view, I should see all nodes IN THAT GROUP. What I am saying is that once I implement my new hook_db_rewrite_sql in a separate module, and return the node.module to its default, unmodified state, as user #1 when I look at that view, I see every node in the database. I understand that user #1 can see everthing, but aparently there is something about the implementation of my hook_db_rewrite_sql that corrupts the normal view restrictions and causes every node in the database to be listed no matter what the view.As far as your user #1 issues are concerned, remember that user_access() always returns true for user #1. So that user generally has unrestricted access to everything.
if ($primary_field == 'nid' &&
!node_access_view_all_nodes()) {
$return['join'] =
og_user_roles_node_access_join_sql($primary_table);
$return['where'] = og_user_roles_node_access_where_sql();
$return['distinct'] = 1;
return $return;
}
}
<>function og_user_roles_node_access_join_sql($node_alias = 'n', $node_access_alias = 'naa') {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?
if (user_access('administer nodes')) {
return '';
}
$return = 'INNER JOIN {node_access} '. $node_access_alias .' ON '. $node_access_alias .'.nid = '. $node_alias .'.nid ';
...my own custom modifications
// I use node_access_alias = "naa" instead of "na". This is to avoid the "duplicate table alias" error.>
-- Ron Parker Software Creations http://www.scbbs.com Self-Administration Web Site http://saw.scbbs.com SDSS Subscription Mgmt Service http://sdss.scbbs.com Central Ave Dance Ensemble http://www.centralavedance.com R & B Salsa http://www.randbsalsa.com