3

I have created a slideshow using the Views Nivo Slider module and added it as a block to the home page of my site (running Drupal 6). Everything works great, but for anonymous users I am getting 2 MySQL errors and the block does not display.

You can see the error message by going here: http://staging.thespanishacademy.com

Naturally, I suspect permissions issues but have triple checked everything, flushed all caches, rebuilt node permissions to no avail.

Any help would be appreciated. I'm also including the exact error message below for historical purposes.

warning: Invalid argument supplied for foreach() in /home/spanish/public_html/staging/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 924.

warning: Invalid argument supplied for foreach() in /home/spanish/public_html/staging/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1000.

warning: Invalid argument supplied for foreach() in /home/spanish/public_html/staging/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 924.

user warning: 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 'FROM node node INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant' at line 2 query: db_query /* Anonymous : db_query / SELECT COUNT() FROM (SELECT DISTINCT FROM node node INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'content_access_author') OR (na.gid = 1 AND na.realm = 'content_access_rid'))) AND ( (node.status = 1) AND (node.type in ('home_page_slideshow')) )) count_alias in /home/spanish/public_html/staging/sites/all/modules/views/plugins/views_plugin_pager.inc on line 141.

user warning: 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 'FROM node node INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant' at line 2 query: db_query_range /* Anonymous : db_query_range */ SELECT DISTINCT FROM node node INNER JOIN node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'content_access_author') OR (na.gid = 1 AND na.realm = 'content_access_rid'))) AND ( (node.status = 1) AND (node.type in ('home_page_slideshow')) ) LIMIT 0, 5 in /home/spanish/public_html/staging/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1150.

3
  • could you have some module switched on that sets the rights for individual fields, too ? i remember there was a module in cck which would by default hide all fields ...
    – mojzis
    Jan 5, 2013 at 20:32
  • Boom! You set me down the right path and I updated the content_permissions module to allow anonymous users to view the correct fields. Thanks! Jan 5, 2013 at 21:23
  • great to know :) i made it into an answer. BTW, are you using views 2 or 3 ?
    – mojzis
    Jan 5, 2013 at 23:14

1 Answer 1

1

When you enable content_permissions together with the rest of cck submodules, the fields you created aren't visible to anonymous users per default. Due to this, views doesn't add any columns to the select statement and you end up with a faulty select. So the solution is to either setup some permissions or switch content_permissions off.
In case you need to setup permissions on fields, i think Field Permissions is nicer - you can select the fields that will be affected, by default all is shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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