TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 547
  • Total: 547

Poll Block

Started by coolmac112, November 30, 2009, 06:56:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

coolmac112

Hi guys,

I've looked around on this site and have seen a few topics regarding displaying the poll to guests but most of them seem to be outdated so i thought i'd just start a new one. I hope im not going against the rules.

Anyways this is what I want:

I want a block that displays the poll even to guest. They might not have voting powers but it should display [maybe when they click on Vote thats when they get told to login/register] or alternatively there could be not button for them. The guests should NOT also see the results of the poll.

I have tried using the ssi php block and its not showing anything to guests...so what'd make them register if they can't even see?

I hope someone can help.

Cheers

Ken.

In your membergroup permissions check to make sure that it is set so guests can view polls.

Also, check to see that a guest can view the block.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

coolmac112

Thanks for the reply.

I have both checked and still there's nothing. I am running smf 1.1.10 by the way. On the portal page the block just appears empty.

JPDeni

Are you using ssi_showPoll? If so, open up SSI.php, find function ssi_showPoll and delete the lines


$boardsAllowed = boardsAllowedTo('poll_view');

if (empty($boardsAllowed))
return array();


and change


$request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD
FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b)
WHERE p.ID_POLL = t.ID_POLL
AND t.ID_TOPIC = $topic
AND b.ID_BOARD = t.ID_BOARD
AND $user_info[query_see_board]" . (!in_array(0, $boardsAllowed) ? "
AND b.ID_BOARD IN (" . implode(', ', $boardsAllowed) . ")" : '') . "
LIMIT 1", __FILE__, __LINE__);


to


$request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD
FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b)
WHERE p.ID_POLL = t.ID_POLL
AND t.ID_TOPIC = $topic
AND b.ID_BOARD = t.ID_BOARD
LIMIT 1", __FILE__, __LINE__);


This should allow everyone to be able to see every poll on your forum, including polls that might be in admin-only boards. I haven't tested it, but it seems that these are the lines that are preventing guests from seeing the polls.

coolmac112

Thanks a lot. That did it, with a few tweaks though :)

Great work, I like how its looking now.

Cheers

JPDeni

Oh, yeah. There's always tweakage to be done. ;) I figure if I point you in the right direction, you can figure out how to get to where you want to go.

This website is proudly hosted on Crocweb Cloud Website Hosting.