Hide donation alerts if the ending time has passed

This commit is contained in:
Alex Cabal 2023-01-01 01:12:44 -06:00
parent 6b32df03ab
commit cebf499c16
2 changed files with 11 additions and 9 deletions

View file

@ -1,16 +1,17 @@
<? <?
$start = new DateTime('May 2, 2022 00:00:00 America/New_York');
$end = new DateTime('May 8, 2022 23:59:00 America/New_York');
$now = new DateTime();
// Hide the alert if the user has closed it // Hide the alert if the user has closed it
if(!DONATION_DRIVE_COUNTER_ON || ($autoHide ?? $_COOKIE['hide-donation-alert'] ?? false)){ if(!DONATION_DRIVE_COUNTER_ON || ($autoHide ?? $_COOKIE['hide-donation-alert'] ?? false) || $now > $end){
return; return;
} }
$autoHide = $autoHide ?? true; $autoHide = $autoHide ?? true;
$showDonateButton = $showDonateButton ?? true; $showDonateButton = $showDonateButton ?? true;
$current = 0; $current = 0;
$start = new DateTime('May 2, 2022 00:00:00 America/New_York');
$end = new DateTime('May 8, 2022 23:59:00 America/New_York');
$now = new DateTime();
if($now < $start || $now > $end){ if($now < $start || $now > $end){
return; return;

View file

@ -1,13 +1,14 @@
<? <?
// Hide the alert if the user has closed it
if(!DONATION_DRIVE_ON || ($autoHide ?? $_COOKIE['hide-donation-alert'] ?? false) || $GLOBALS['User'] !== null){
return;
}
$start = new DateTime('November 28, 2022 00:00:00 America/New_York'); $start = new DateTime('November 28, 2022 00:00:00 America/New_York');
$end = new DateTime('December 31, 2022 23:59:00 America/New_York'); $end = new DateTime('December 31, 2022 23:59:00 America/New_York');
$now = new DateTime(); $now = new DateTime();
// Hide the alert if the user has closed it
if(!DONATION_DRIVE_ON || ($autoHide ?? $_COOKIE['hide-donation-alert'] ?? false) || $GLOBALS['User'] !== null || $now > $end){
return;
}
$autoHide = $autoHide ?? true; $autoHide = $autoHide ?? true;
$showDonateButton = $showDonateButton ?? true; $showDonateButton = $showDonateButton ?? true;
$current = Db::QueryInt(' $current = Db::QueryInt('