<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Dave Cohen wrote:
<blockquote cite="mid200707260836.07984.drupal@dave-cohen.com"
type="cite">
<pre wrap="">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.
</pre>
</blockquote>
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.<br>
<blockquote cite="mid200707260836.07984.drupal@dave-cohen.com"
type="cite">
<pre wrap="">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.
</pre>
</blockquote>
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.<br>
<br>
Again, here is my hook_db_rewrite_sql() code:<br>
<br>
function og_user_roles_db_rewrite_sql($query, $primary_table,
$primary_field) {
<p> if ($primary_field == 'nid' &&
!node_access_view_all_nodes()) {<br>
$return['join'] =
og_user_roles_node_access_join_sql($primary_table);<br>
$return['where'] = og_user_roles_node_access_where_sql();<br>
$return['distinct'] = 1;<br>
return $return;<br>
}<br>
} </p>
Further along:<br>
<blockquote><>function og_user_roles_node_access_join_sql($node_alias =
'n', $node_access_alias = 'naa') {<br>
if (user_access('administer nodes')) {<br>
return '';<br>
}<br>
$return = 'INNER JOIN {node_access} '. $node_access_alias .' ON '.
$node_access_alias .'.nid = '. $node_alias .'.nid ';<br>
...my own custom modifications<br>
// I use node_access_alias = "naa" instead of "na". This is to avoid
the "duplicate table alias" error.</>
</blockquote>
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?<br>
<br>
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!<br>
<br>
-ron<br>
<pre class="moz-signature" cols="72">--
Ron Parker
Software Creations <a class="moz-txt-link-freetext" href="http://www.scbbs.com">http://www.scbbs.com</a>
Self-Administration Web Site <a class="moz-txt-link-freetext" href="http://saw.scbbs.com">http://saw.scbbs.com</a>
SDSS Subscription Mgmt Service <a class="moz-txt-link-freetext" href="http://sdss.scbbs.com">http://sdss.scbbs.com</a>
Central Ave Dance Ensemble <a class="moz-txt-link-freetext" href="http://www.centralavedance.com">http://www.centralavedance.com</a>
R & B Salsa <a class="moz-txt-link-freetext" href="http://www.randbsalsa.com">http://www.randbsalsa.com</a>
</pre>
</body>
</html>