It's not possible to display correct relevant content block with Domain Access
module. Relevant Content block shows nodes from all domains.

"All node listing queries are supposed to be wrapped in db_rewrite_sql() in order
to enforce node access rules." [1]



nicholasThompson’s picture

Assigned:Unassigned» nicholasThompson

Ah ok - thanks very much for this! I was concerned I might have to do a node_load and a node_access check on every link...

nicholasThompson’s picture

Status:Active» Needs work

Will be applied soon.

ajayg’s picture

Status:Needs work» Active

I do not see any patch attached.

ajayg’s picture

Status:Active» Needs review

I made following change to 5.x version of the module and now it seems to respect node access.

Search for following line in the function relevant_content_get_nodes.
$result = db_query($sql, $values);

and change to
$result = db_query(db_rewrite_sql($sql), $values);

I tested this with 5.x version with OG node acess enabled.

fuerst’s picture

This issue really is important and I hope it will be fixed soon.
Meanwhile you have to manually patch the module like mentioned in comment #4 which is somewhat uncomfortable.

ajayg’s picture

did you try the patch above as it is working for you? If it works then we can mark this ready to be commited.

fuerst’s picture

Status:Needs review» Reviewed & tested by the community

Yes, it is working well.

muckermarc’s picture


I changed the same line in Relevant Content v6.x.1-4 and it respected the access rights to nodes restricted via the Domain Access module.

Thanks to Szy for pointing me in the direction of this module, and to ajayg for the code snippet.


ajayg’s picture

@nicholasThompson, please accept the patch. I submitted several months ago and have been reviewed by community for a while.

ajayg’s picture

Could we please get this patch in both 5.x and 6.x please?

nicholasThompson’s picture

As I posted in another issue - I have been a bit quiet in the past few months as I've been organising my wedding in any spare time I had. My wedding and honeymoon are now finished :-( but on the positive side I should now have a little more time to dedicate to this. I plan to commit several patches from the queue plus some fixes from www.sportbusiness.com and finally update it to Drupal 7.

Thanks for the patience! :)


lal2017’s picture

I am using NodeAccess module - (Nodeaccess 6.x-1.3, http://drupal.org/project/nodeaccess) on Drupal 6.14, to restrict access to nodes. Seems similar problem as described by others above. Where Relevant Content block lists nodes which are restricted. Although when you actually click on them, it gives an access denied message. However I would like to hide these in the first place so users can't see what nodes are restricted.

Hopefully the fix is going well. Thanks for the module, its a gem.

Warm regards,

ajayg’s picture

Any update on this? CAn this patch be applied to 6.x branch

nicholasThompson’s picture

I'm going to sort this out very soon. I've been working on updating this and Page Title into Drupal 7. Fixes & features from that work will be backported to V6.

ajayg’s picture

Since this is only 1 line fix it will benefit the module 2 ways
1. It will solve the long pending need for the module users
2. This module hasn't seen a release in almost 1 year. Seeing the latest release date will help spread of this module.

Not that it will happen here, but I have seen too many times developer trying to combine a few things together and everything getting delayed because of one painstaking issue.

I am hoping since the community is already trying to help you by submitting patches, please give your attention. If other patch submitters see their patches are not getting commited (even after you agreeing those are correct patches) they will loose interest in helping you. My 2 cents.

ajayg’s picture

Any update on this ? Can this one line patch be commited?

Gabriel Radic’s picture

For some reason, I don't see the patch files above :-s

nicholasThompson’s picture

I am going to commit this - I just need to find some time. I'm also working on upgrading all my modules to work in D7 too.. As well as writing SimpleTests to help avoid bugs in the future.

scor’s picture

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.