summaryrefslogtreecommitdiff
path: root/modules/poll.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/poll.module')
-rw-r--r--modules/poll.module30
1 files changed, 16 insertions, 14 deletions
diff --git a/modules/poll.module b/modules/poll.module
index 2dcb835ee..f799bf5e1 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -43,22 +43,24 @@ function poll_access($op, $node) {
}
function poll_block($op = "list", $delta = 0) {
- if ($op == "list") {
- $blocks[0]["info"] = t("Most recent poll");
- return $blocks;
- }
- else {
- $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type = 'poll' AND status = '1' AND moderate = '0'"));
- if ($timestamp) {
- $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
- if ($poll->nid) {
- // Poll_view dumps the output into $poll->body
- poll_view($poll, 1, 1);
+ if (user_access("access content")) {
+ if ($op == "list") {
+ $blocks[0]["info"] = t("Most recent poll");
+ return $blocks;
+ }
+ else {
+ $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type = 'poll' AND status = '1' AND moderate = '0'"));
+ if ($timestamp) {
+ $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
+ if ($poll->nid) {
+ // Poll_view dumps the output into $poll->body
+ poll_view($poll, 1, 1);
+ }
}
+ $block["subject"] = t("Poll: %t", array("%t" => $poll->title));
+ $block["content"] = $poll->body;
+ return $block;
}
- $block["subject"] = t("Poll: %t", array("%t" => $poll->title));
- $block["content"] = $poll->body;
- return $block;
}
}