Display unpublished referred nodes too

jmesam - August 26, 2008 - 21:01
Project:NodeReferrer
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Is it possible to display unpublished referred nodes with NodeReferrer?

#1

trailerparkopera - April 13, 2009 - 17:55

Yes...but you have to modify the module.

Replace (on line 400 or so in nodereferrer.module):

      $query = "SELECT       n.nid, n.vid, n.title
                  FROM         {" . $db_info['table'] . "} nr
                  INNER JOIN   {node} n ON n.vid = nr.vid AND n.status = 1 ". $filter_nodetypes ."
                  WHERE        nr." . $db_info['columns']['nid']['column'] . " = %d
                  ORDER BY     ". $order;

With this:

     $query = "SELECT       n.nid, n.vid, n.title
                  FROM         {" . $db_info['table'] . "} nr
                  INNER JOIN   {node} n ON n.vid = nr.vid ". $filter_nodetypes ."
                  WHERE        nr." . $db_info['columns']['nid']['column'] . " = %d
                  ORDER BY     ". $order;

Notice the change in the INNER JOIN line.

A colleague and I will work towards making a patch that adds this as a configuration option and submit it here for consideration for inclusion. Meanwhile, this will do what you want I think.

#2

pztrick - July 12, 2009 - 02:54

Thank you this is exactly was I was looking for. Works great.

I actually use a Views 2 block to display my node referrers field -- so even with this module edit it is still possible for me to block unpublished nodes by adding a views filter... perhaps the change trailerparkopera showed above should be the default behavior for this module, and let persons with other needs adjust it with views?

good luck adding a configuration option, trailerparkopera.

 
 

Drupal is a registered trademark of Dries Buytaert.