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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 777
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 123
  • Total: 123

How to feature a forum poll in TP?

Started by misjka, January 05, 2006, 06:26:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rasyr

Have you tried making a new poll and seeing if you can see that? It may be that for some reason the forum thinks you have voted already.

Look up at the code changes I posted above, specifically the second one where you add the closing and opening TR tags. The line above it is the text for each option, and the line below is the actual percentile bar.

So, you can change


echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2"><b>', $return['question'], '</b></td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td align="right" valign="top">', $option['option'], '</td>
<td align="left">', $option['bar'], ' ', $option['votes'], ' (', $option['percent'], '%)</td>
</tr>';
echo '
<tr>
<td colspan="2"><b>', $txt['smf24'], ': ', $return['total_votes'], '</b></td>
</tr>
</table>';



to something like:


echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td><font size="-1"><b>', $return['question'], '</b></font></td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td align="left" valign="top"><font size="-1"><b>', $option['option'], '</b></font></td>
                                                </tr><tr>
<td align="left">', $option['bar'], ' ', $option['votes'], '<font size="-1"> (', $option['percent'], '%)</font></td>
</tr>';
echo '
<tr>
<td><font size="-1"><b>', $txt['smf24'], ': ', $return['total_votes'], '</b></font></td>
</tr>
</table>';


Note: You allready changed part of this with my earlier instructions & I forgot about the colspans of the sections above and below the poll options, that may be what was causing it to break the box as opposed to the text size.

misjka

#11
Hmmm... How odd  :uglystupid2:

This is what a did:

1. Created a new poll in my public forum, just as you told me to do, as admin. Chosed the option that all voters may change their choice...
2. It all turned up fine in the block as a previewed it and after been activating it, at least as I was logged in as admin... I saw the poll form, the submit button etc... :D
3. I logged out and as guest I then only saw the results  :(...
4. Logged in as Global Moderator, I still just saw the results (had not voted) >:(
5. Logged out again and relogin as admin, then the poll form turned up again  :o
6. As admin, i made a vote but the result from it didn't show up - just the form again with my chosen radiobutton as default  :(
7. Logged out again and as guest and as Global Moderator it looked as before, just the poll results...
8: Relogin as admin and eventually the poll result shows up  ^-^, so it almost worked as supposed to anyway  ;). But now I no longer may change my vote, since the form is gone and there's no link in the box below the result for changing my vote  :-\

Btw, I set up the block with permissions for everyone...

Rasyr

You might want to go into the SMF permissions and see what they are for the various user groups, that may be what is causing the issue...

The SSI function does have thing built upon the SMF permissions. So for this you not only have the TP permissions, but also the SMF permissions to deal with as well...




misjka

#13
Yes, I see what you mean but I do think that it shouldn't be the case since I deliberately put the poll in a public board that anyone but guest may vote in...

BUT, I did a check about this anyway and here is the weird result:

1: If I login as a user (in this case Global Moderator) I still cannot vote in the portal block, just see the result (I haven't voted as a user).
2: I go to the forum an view the poll and there I may vote... and eventually the block changes as well as long as I view the vote form in the forum, I may vote in the block as well  :o
3: But when I change view to the forum index in the forum, the block form once again disappears and just shows the result... :tickedoff:
4: If I enter the same board, or another board, then I may vote once again in the block ^-^ - no matter what board I'm viewing...  :o

Hope this would give you a clue to hunt this issue down... :coolsmiley:?

misjka

I followed your advice for a code change in reply #10, and it worked so fine :).

But, to get the text within the block look somewhat clearer I changed the bold font for the $option line to italic instead (that way the title, options and results are easier to separate in a quick glance, I think)...

That is,

                  <td align="left" valign="top"><font size="-1"><i>', $option['option'], '</i></font></td>

misjka

BTW, I could make use of a "Change vote" link in the bottom of the poll result block...  :buck2: I did not find any ssi code for that...

misjka

Quote from: misjka on January 05, 2006, 03:42:05 PM
Thanks, that seemed to work... but I only got the poll result, not the voting form itself (I haven't voted in that poll myself)... Instead of the $topic string I just wrote the number of the topic, ssi_showPoll(684.0);
that is... Right or wrong...?

Hmmm, now this whole thread is valid (again :() after the .86 upgrade... Is there something special to have in mind before I perform the modifications once again?

This website is proudly hosted on Crocweb Cloud Website Hosting.