Under the following conditions:

1. Content Access module is enabled
2. It is not necessary to restrict page access for this test
3. Log in as an Authenticated User (other than user/1)
4. Click on a random image to be taken to the images node.

In place of the page heading, you will get:

    * user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT title FROM blocks 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 = 8 AND na.realm = 'content_access_author') OR (na.gid = 2 AND na.realm = 'content_access_rid'))) AND ( module='random_images' AND delta='1' AND theme='') in /home/[removed]/sites/all/modules/random_images/random_images.module on line 30.

    * user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT title FROM blocks 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 = 8 AND na.realm = 'content_access_author') OR (na.gid = 2 AND na.realm = 'content_access_rid'))) AND ( module='random_images' AND delta='1' AND theme='garland') in /home/[removed]/sites/all/modules/random_images/random_images.module on line 30.

Comments

DrewMathers’s picture

I have done a workaround for this problem by taking the displayed title from the pictures source page instead of the block title.

function random_images_title($delta = '') {
  $nid = (int) variable_get('random_images_block_node_' . $delta, 0);
  $node = node_load($nid); 
  $title = $node->title;
  drupal_set_title(check_plain($title));
}
Ivan Simonov’s picture

Status: Active » Needs review

I try to reproduce (user #1):
1) On the new site install Content Access & Random Images modules.
2) Enable both. Upload images for "Random Images".
3) Set block Tittle.
4) Rebuild access rights (/admin/content/node-settings/rebuild)
5) Click on image - No errors on /random_images/1 page.

6) Allow guests to see "Random Images" block and page.
7) Guest got error on "Random Images" page.

User warning: Unknown column 'n.nid'
But I am not use column 'n.nid'
Query is: "SELECT title FROM {blocks} WHERE module='random_images' AND delta='%d' AND theme='%s'"

I think we have to ask "Content Access" developer about this warning.
I suppose "Content Access" module rebuild query incorrect way.

For me your way not so good because Page Tittle in this case used for administrators, but Block Tittle shown for users (page is container and usually unpublished). What if somebody want to create 2 similar blocks with different tittles?

Anyway we need more info from "Content Access" developers.

DrewMathers’s picture

Here is a similar issue from the Content Access queue: #517810: Unknown column 'n.nid'

Ivan Simonov’s picture

You right - incorrect use of db_rewrite_sql() function.

Check please this fix:
Remove db_rewrite_sql() function from line #30 and fluch cache.

$result = db_result(db_query($sql, $delta, $theme));

Next commit will fix it.

tgeller’s picture

Irrelevant to your question: Congrats on creating node #900,000! ;)

Ivan Simonov’s picture

I find this number fun too :) Where is a prize?

Ivan Simonov’s picture

Status: Needs review » Closed (fixed)

Fixed in 6.x-1.x-dev