Hi,
I have set up multiple sites with Drupal.
I am using Drupal 4.7.6 and the Category module. It is working fine, until I got this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(n.nid) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid INN' at line 1 query:
SELECT n.title, DISTINCT(n.nid) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND tn.tid = 254 AND n.nid != 317 LIMIT 5
Can somebody help how to fix this?
Thanks in advance,
greetings,
Martijn
Comments
Comment #1
keve commentedThis is not a Taxonomy_access issue.
Find, which of your modules generate this SQL query. (you can try to find it with devel.module).
That module uses db_rewrite_sql in a wrong way.
The query should start with "SELECT n.nid", instead of "SELECT n.title".
Comment #2
summit commentedAfter more research, I saw this thread: http://drupal.org/node/89776
With removing:
from the node_db_rewrite_sql function in node.module the User Warning is gone!!
But the taxonomy access is also permitted now to everybody!! so this is a needed peace of code maybe...
Please help.
The error is only when Taxonomy Access activated, deactivating Taxonomy Access resolves the issue, so can't it be within Taxonomy Access than?
Thanks for your quick reply,
greetings,
Martijn
Comment #3
keve commentedYou have not solved the issue, you made a roundabout. Becasue node_db_rewrite_sql() works fine for all other modules.
Try to find, which of your modules generates query: w/ db_rewrite_sql():
beginning with "SELECT n.title, n.nid FROM node n" (Maybe you can do a text search in your module directory.)
OR if you install devel.module w/ display query option, there you can see which function calls this query.
Comment #4
summit commentedHi,
Off course are the exact lines not in the code. But with the devel module installed I found something.
The log says:
ms # where query
0.27 1 eval SELECT n.title, DISTINCT(n.nid) FROM GR_node n INNER JOIN GR_term_node tn ON n.nid = tn.nid WHERE
tn.tid = 114 AND n.nid != 232 LIMIT 5
I filtered it down to the .fitler module, but then I don't understand what to do.
Is a filter wrong, is the api not ok?
Thanks in advance,
greetings,
Martijn
Comment #5
summit commentedI am trying the following now:
I have a Master site and a slave site.
Make the following tables site-dependend by placing this code in settings.php from the slave-site:
The idea is that because of this the access to content can be depended on the site which the settings.php refers to.
But it is not working.
The master-site access is ok and easy to install through Taxonomy Access Control.
The slave-site is showing all content no matter which terms I tell the Taxonomy Access Control from the slave-site to have access to (the radio buttons, Allow, Ignore Deny).
The settings of Taxonomy Access Control are nicely shown in the slave-site TAC table, but the access is granted without using this I think.
I saw TAC-module has a dependency with Node_access table, so this table I also prefix for every slave-site.
Is this the way to handle this?
Please help getting taxonomy access and node access right for master and slave site.
I don't want all the master-content also shown on the slave-site, thats my goal!
Thanks in advance,
greetings,
Martijn
Comment #6
keve commented#4: eval() is mainly used in nodes where you allow content with php code in it (the php filter).
#5: I have not try to share tables never.
But i guess: If you share $term_access tables, then you have to share ALL tables w/ that are used by the taxonomy.module. Otherwise how will the tid values connect to each other?
If you share node_access, than you have to share also tables with the nodes, (table node, term_node) maybe others. Otherwise how will the nid values connect to each other?
Comment #7
summit commentedHi Keve,
I think I got it working with the smallest manual steps...
I have installed the Taxonomy Access Module and The Nodeaccess module.
I use one site as Master-site in which the content is being typed in.
I use ONLY above tables as site-specific in settings.php.
When a node is submit it first will only be available in the node_access table from the Master site.
But know comes the magic!!.. when in the slave-site on Nodeaccess settings page only the [SAVE GRANTS] is clicked..the node_access table from the slave-site will have the new node number included!!
After this the same trick is being played with the Taxonomy Access Control.
(The Taxonomy Access need off course to be set to the correct values for the Terms)
Then only you need to click on [SAVE CATEGORY PERMISSIONS]
Now the slave-site have the correct access rules for the new node!!
Greetings,
Martijn
Comment #8
keve commentedComment #9
keve commentedComment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.