summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Altenhofel2012-03-14 14:23:40 (GMT)
committer Brian Altenhofel2012-03-14 14:23:40 (GMT)
commit3dae144aba6049037fa7a73f6e29d0cac100447b (patch)
tree225d012f418c729c27508c16e3e40899cb261bb5
parent18d1a6133500ab6c9867234630fb142635cd0ad2 (diff)
Correction to usage of core function7.x-1.4
-rw-r--r--slidebox.module9
1 files changed, 8 insertions, 1 deletions
diff --git a/slidebox.module b/slidebox.module
index 57b8b82..0ba3386 100644
--- a/slidebox.module
+++ b/slidebox.module
@@ -89,10 +89,17 @@ function slidebox_data($node, $view_mode) {
if ($view_mode != 'full' || !node_is_page($node) || !in_array($node->type, variable_get('slidebox_content_types'))) {
return FALSE;
}
+
$result = db_query("SELECT nid, title FROM {node} WHERE created < :created AND type = :type AND status = :status ORDER BY created DESC LIMIT 1",
array(':created' => $node->created, ':type' => $node->type, ':status' => 1));
- return is_object($result) ? $result->fetchAssoc() : FALSE;
+ $slidebox = is_object($result) ? $result->fetchAssoc() : FALSE;
+
+ if (TRUE != node_access('view', node_load($slidebox['nid']))) {
+ return FALSE;
+ }
+
+ return $slidebox;
}
/**