mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 01:22:23 -04:00
Redirect ended polls to the results page
This commit is contained in:
parent
7201081aed
commit
35565d90f6
1 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,12 @@ $canVote = true; // Allow non-logged-in users to see the 'vote' button
|
||||||
try{
|
try{
|
||||||
$poll = Poll::GetByUrlName(HttpInput::Str(GET, 'pollurlname', false));
|
$poll = Poll::GetByUrlName(HttpInput::Str(GET, 'pollurlname', false));
|
||||||
|
|
||||||
|
if(!$poll->IsActive() && $poll->End !== null && $poll->End < new DateTime()){
|
||||||
|
// If the poll ended, redirect to the results
|
||||||
|
header('Location: ' . $poll->Url . '/votes');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($GLOBALS['User'])){
|
if(isset($GLOBALS['User'])){
|
||||||
$canVote = false; // User is logged in, hide the vote button unless they haven't voted yet
|
$canVote = false; // User is logged in, hide the vote button unless they haven't voted yet
|
||||||
try{
|
try{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue