make similar content respect the rules set by with private module

rahulb - August 7, 2009 - 19:12
Project:Similar Entries
Version:6.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

The private module provides a great way to limit viewing of nodes by role. This didn't play nice with similar_entries out of the box, because similar entries would show nodes to the user even if they were not allowed to see them (because of a private module permission).

I was able to use the theme_similar_content to override this by including the following code in the main while block:

    // if the site has the "private" module installed, make sure the related node is viewable
    if(module_exists("private")) {
      if ( ($content->private==PRIVATE_ALLOWED) && (user_access("access private content")==false) ) continue;
    }

I thought I'd post it here in case anyone else was trying to do the same thing, or if you wanted to include it in the module (If I've done it correctly). Thanks.

#1

rahulb - August 7, 2009 - 19:13
Title:which list of similar respected rules set by private module» make similar content respect the rules set by with private module
 
 

Drupal is a registered trademark of Dries Buytaert.