Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: inter on May 17, 2018, 08:02:24 PM

Title: Recent poll in SSI.php - not showing the results for members
Post by: inter on May 17, 2018, 08:02:24 PM
Quote
You 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

Code: [Select]
<?php ssi_recentPoll(); ?>
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: Suki on May 17, 2018, 08:49:32 PM
The most recent poll might live in a board a user does not have access to.
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: inter on May 18, 2018, 03:48:37 AM
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:

Quote
The 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?
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: Suki on May 18, 2018, 05:08:52 PM
Cannot reproduce it, I need more info. Where exactly did you create the poll? what kind of permissions does the board has?
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: inter on May 20, 2018, 04:32:34 AM
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:
Code: [Select]
// This user has voted on all the polls.
if ($row === false)
return array();

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

Find:
Code: [Select]
$already_voted = $allow_vote;

Replace:
Code: [Select]
$already_voted = !$allow_vote;
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: Suki on May 20, 2018, 08:01:17 AM
Still need more details to properly reproduce this.
Title: Re: Recent poll in SSI.php - not showing the results for members
Post by: inter on May 20, 2018, 08:11:51 AM
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.