News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Recent poll in SSI.php - not showing the results for members

Started by inter, May 17, 2018, 08:02:24 PM

Previous topic - Next topic

inter

QuoteYou cannot see the results of this poll at the moment.

why does not a simple user see the survey results? So it should be?

example page: https://www.simplemachines.org/community/ssi_examples.php

smf: SMF 2.0.15

<?php ssi_recentPoll(); ?>
Sorry for my English

Suki

The most recent poll might live in a board a user does not have access to.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

inter

it seems to me strange, then why is it needed at all, if it does not show what they want from it?




hmmm

http://.../ssi_examples.php

"recent poll" block:

if user is admin:

QuoteThe database value you're trying to insert does not exist: current_poll

SMF 2.0.15
MySQL: 5.6.32-78.0-log
PHP: 7.1.13

Do you have such a mistake?
Sorry for my English

Suki

Cannot reproduce it, I need more info. Where exactly did you create the poll? what kind of permissions does the board has?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

inter

I realized how this function works:
1. this function does not show poll results (if only you are a guest and you are allowed to vote)
2. this function shows only the voting form or the aggressive text about the lack of access rights that I propose to replace with the text - there are no new polls for voting




I made several fixes for the SSI.php file:

Find:
// This user has voted on all the polls.
if ($row === false)
return array();


Replace:
// This user has voted on all the polls.
if ($row === false || $row === null)
return array();


Find:
$already_voted = $allow_vote;


Replace:
$already_voted = !$allow_vote;
Sorry for my English

Suki

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

inter

delete this topic, I'm wasting your time in vain. I did not understand how this function works and I thought that there was an error in it.
Sorry for my English

Advertisement: