If in poll settings you mark option "Only show the results after someone has voted." under this poll regular user can see button "View results" even if they did not voted yet.
Tested on clean SMF 2.0.2 UTF8
Didn't see this reporter before ::)
But if they press it they don't see anything, right?
Yes, page is reloaded and they can't see results, but anyway button shouldn't be displayed
Yes, of course. It was just to be sure. ;)
I think this should fix it:
$context['show_view_results_button'] = $context['allow_vote'] && (!$context['allow_poll_view'] || !$context['poll']['show_results'] || !$context['poll']['has_voted']);
$context['show_view_results_button'] = $context['allow_vote'] && ($context['allow_poll_view'] || $context['poll']['has_voted']) && !$context['poll']['show_results'];
Not tested in many conditions, but should make more sense...
yes this fixed it :)
Quote from: emanuele on June 01, 2012, 01:31:45 PM
$context['show_view_results_button'] = $context['allow_vote'] && ($context['allow_poll_view'] || $context['poll']['has_voted']) && !$context['poll']['show_results'];
Apparently the
|| $context['poll']['has_voted']
part is harmless, because it cannot be true if the user does not have the right to vote (or can it if the right has been taken away afterwards?), but it is unnecessary.
In fact the fix applied to 2.1 is even different:
$context['show_view_results_button'] = $context['allow_vote'] && (!$context['allow_poll_view'] || !$context['poll']['show_results'] || !$context['poll']['has_voted']);
I think I tested it to come up with this series of conditions, but don't remember anymore... lol
Isn't that the original code that does not work?
lol
That's embarrassing... :-[
Closing old 2.0 bugs - 2.0 is in security fixes-only at this point.