Advertisement:

Author Topic: Recent poll in SSI.php - not showing the results for members  (Read 2661 times)

Offline inter

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • interlab on GitHub
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(); ?>
Sorry for my English

Offline Suki

  • Carthago delenda est
  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 15,956
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Recent poll in SSI.php - not showing the results for members
« Reply #1 on: May 17, 2018, 08:49:32 PM »
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.

Making tough decisions, so you don't have to.

Offline inter

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • interlab on GitHub
Re: Recent poll in SSI.php - not showing the results for members
« Reply #2 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?
Sorry for my English

Offline Suki

  • Carthago delenda est
  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 15,956
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Recent poll in SSI.php - not showing the results for members
« Reply #3 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?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Making tough decisions, so you don't have to.

Offline inter

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • interlab on GitHub
Re: Recent poll in SSI.php - not showing the results for members
« Reply #4 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;
Sorry for my English

Offline Suki

  • Carthago delenda est
  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 15,956
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Recent poll in SSI.php - not showing the results for members
« Reply #5 on: May 20, 2018, 08:01:17 AM »
Still need more details to properly reproduce this.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Making tough decisions, so you don't have to.

Offline inter

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • interlab on GitHub
Re: Recent poll in SSI.php - not showing the results for members
« Reply #6 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.
Sorry for my English