diff --git a/intlinks_hide_bad_links.inc b/intlinks_hide_bad_links.inc index 464ef8b..f02bb3c 100644 --- a/intlinks_hide_bad_links.inc +++ b/intlinks_hide_bad_links.inc @@ -16,6 +16,8 @@ include_once 'intlinks_common_functions.inc'; /** * More efficient way to get node status (un/published) than using node_load(). + * We include an alter hook to allow other modules to override the definition + * of what is published. * * @param $nid * The node id corresponding to the node status this function returns. @@ -26,8 +28,16 @@ include_once 'intlinks_common_functions.inc'; * add handling to log links as possible errors (no node with $nid exists). */ function intlinks_is_published($nid) { - return db_query("SELECT status FROM {node} WHERE nid = :nid", - array(':nid' => $nid))->fetchField(); + static $is_available = array(); + + if (!isset($is_available[$nid])) { + $is_available[$nid] = db_query("SELECT status FROM {node} WHERE nid = :nid", + array(':nid' => $nid))->fetchField(); + + drupal_alter('intlinks_is_published', $is_available[$nid], $nid); + } + + return $is_available[$nid]; } /*