Hey & G'day
I am new here
I was just wondering if it was possible to display the results after someone has voted in a poll, let me alaborate a little, I have a front page poll in a block, when a guest votes, the poll disapears (the block stays, though reduced), obviously because I have set up the polls to only allow 1 vote per user, but what I want it to do is, once someone has voted, I want the block to show the results of the poll, rather than an empty block everytime they visit my site, is this possible?
Regards Denis
den15b,
Welcome to TP.
Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581) and provide the requested information so that we may help you more with your isseu.
Link to my site: http://www.videohelp1.com
SMF version: SMF ver. 1.1.9
TP version: TP v1.0 beta 4
Theme name and version: Default core theme
Browser Name and Version: IE/7
Mods installed: TinyPortal only
Related Error messages: N/A
If you vote on the front page, you will see that the poll disapears when you return to the home page, I was hoping it would display the results even if you leave the site & return, the poll results would still be there, but at the moment, the poll just disapears with the block being reduced.
Thankyou
Regards Denis
Hello den15b,
When I visit the site the Poll Block on the right is empty, no chance to vote first. Please post the code you are using for this block so that we can try it on our own test sites and perhaps one of our coders can tell you what is the matter with it.
ZarPrime
Thanks for the reply, so it is actualy worse than I thought, that means only 1 vote & it is closed from the front Page for every guest, would it be better if I granted someone temporary admin access? is this safe of me offering this?
It would be better if you did what ZarPrime suggested and posted your code so we could take a look at it.
Please use the "code" tags -- the # button on the reply form -- around your code.
Ok, I will do that, but it is 1 in the morning here in oz, so i'll do it in the morning, thankyou
Regards Denis
Um, where do I get the code from? sorry for the dumb question
Let me know if this helps. I think you're talking about a bug in the way SMF handles the polls.
http://www.tinyportal.net/index.php?topic=9623.0
Quotewhere do I get the code from?
Go to the TP Admin area and edit that block. That's where the code is.
[REMOVED]
hope this is right
No.
Do you remember what you did when you created the block? Tell us what you did to make the block you have.
Ok,
I went to the TinyPortal admin
Then I clicked on "Panels and Blocks"
Then I clicked "Add right block"
Then I selected type "Forum/SSI Functions" / Most recent Poll
Status is On
Choose your membergroups that will able to see this block, to "All"
Choose where the block should appear, to "Frontpage"
Did i get it right this time
Yes. :)
You're using the SSI function. (There are other ways to display a poll than using SSI.)
That seems to have a bug in it, as mentioned by IchBin.
Quote(There are other ways to display a poll than using SSI.)
OK, do you mind telling me the other ways please
Denis
Hi den15b,
The reason this is not doing what you want it to do is that the php ssi_recentPoll function allows you to vote but it doesn't display the results.
On my test site, which is http://talesofthehavenexpanse.com/smf1test/index.php, I just added this php block to show the most recent polls in boards 1 and 2. You must be logged in to vote (this is a security feature, in other words Guests can't vote) but since guests can view the polls, you will be able to see both polls in the block in the right panel.
In order to do this, I used the block code snippet shown here ...
http://www.tinyportal.net/index.php/topic,12807.msg106401.html#msg106401
I changed the last 2 lines in the code to this ...
// display most recent poll from board number 1 and 2
tp_showPoll(null,'echo',1);
echo '<br /><hr />';
tp_showPoll(null,'echo',2);
This allows me to show the most recent poll from both boards. I voted in the poll in board #1 (the string poll), but not in the poll for board #2 (the dog poll). If you were allowed to be logged in, you would be able to vote in the second poll right from the block as there would be a submit button below that one. Once you voted, ths view would change to show the results in the bottom poll just like it is shown for the top poll.
Hope this helps,
ZarPrime
EDIT: I just added a 3rd poll in a 3rd board on my test site and added another line to the bottom of the block code to get the poll in that board. If you are logged in and haven't voted in any of the polls that are up there, the submit button will be shown for those polls until you vote. See pic below ...
Thanks for that, I will try it, by the way, I want to let guests vote as well, any chance of that happening
Regards Denis
Quote from: den15b on June 05, 2009, 04:59:11 PM
I want to let guests vote as well, any chance of that happening
No, no chance, as far as I can tell. Why in the world would you want to allow non-members to vote? Isn't it a goal to get people to be a member of your forum. Voting is and should be a privelage for members, not for guests.
BTW, it appears that this code will not allow you to vote from the block if you have more than 1 poll showing in the block. Showing the most recent poll period may be a limitation of the code. I'll have to look at this later and see if anything could be done about that, or perhaps one of our coders can take a look at it and see if anything can be done about that.
ZarPrime
QuoteBTW, it appears that this code will not allow you to vote from the block if you have more than 1 poll showing in the block.
Thats Ok with me, I only want 1 poll showing at a time
So no chance with the guest being able to vote, I was hoping they could vote, but not to worry, I have tried that code out & it works perfect, thankyou for your time
Denis
I don't know of any way to allow guests to vote for this reason ...
How would the software know that a guest has already voted and keep them from voting another 50 times if it didn't register their usernames in the database that they already voted? I suppose it could be done with IP addresses but then a guest who has access to dynamic IP addresses could still vote multiple times. I don't think this is something I'd want to see.
Marked solved.
ZarPrime
Just a side note here, guest can vote with SMF 2.0 RC1-1 if the option is set, but TP is not ready has yet for smf 2.0
That's great news Lesmondâ„¢, I want to be able to allow guests to vote, & I am not really concerned if people vote more than once, after all, it's just for fun, but I have noticed that a site I frequent does have a front page poll that guests are allowed to vote on, it seems that when you vote as a guest & leave the site, apon returning the site has remembered you & will not allow you to vote again, however, I have worked out that if you delete your cookies, you can vote again, so obviously the poll vote uses the cookies to remember who you are, do you think that SMF2.0 or TP has/will implement this?
BTW, the block code snippet that ZarPrime linked me to is working great on my site, you bunch are really helpful & friendly around here, thankyou
Regards Denis
[edit] fix typos
Thanks for this code, I have it up and running at PlanetDescent.net (http://planetdescent.net). Only one thing, I have the Poll set to view poll results only after voting, but I can view the poll results by logging out. ie, Guests can view results. Ideally, I would like guests to see the options, along with a message directing them to login or register to vote and view results. It seems a little odd to view the results, then login and be told to vote before viewing the results... :o
Then don't allow guests to view the block at all. You can create a "guest-only" block that says something like "If you would like to vote in polls, you must log in first."
Thanks for the quick reply!
If there's no way to let guests see the options but not vote, then I will let everyone see the results before voting, so at least it's consistent. It's just for fun anyway... ;)
You can change the code if you want. If you're using the tp_showPoll function,
before
else
{
echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2" class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>';
add
elseif ($user_info['is_guest'])
{
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2" class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td colspan="2" align="left" valign="top" style="font-style: italic" class="smalltext">', $option['option'], '</td>
</tr>';
echo '
</table>
If you would like to vote in this poll, please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';
}
Also, change
global $context;
to
global $context, $scripturl;
Quote from: JPDeni on June 07, 2009, 04:20:07 PMIf you're using the tp_showPoll function,
OOPS, sorry, I posted in the wrong thread. I am using the code in a thread Zarprime linked to on page 2 of this thread.
That would be the tp_showPoll function. That's where I got the code, too.
Ok... well, I tried your code above anyway and I got an empty block. I'll try again, maybe tomorrow. :up: I probably copied something wrong...
If you still have problems, post your code so I can see what's wrong.
Would you prefer I start a new thread?
Yeah, probably best since this one is marked solved.
ok... http://www.tinyportal.net/index.php/topic,29904.msg238326.html#msg238326