From 7ac427dad567e33f14366e3b0e75dfea3cb7a044 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Thu, 5 Dec 2024 21:00:39 -0600 Subject: [PATCH] Add more information to user info page --- lib/User.php | 17 ----------------- www/css/user.css | 4 ++++ www/users/get.php | 12 ++++++++++-- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/User.php b/lib/User.php index 456da5f5..6edf2447 100644 --- a/lib/User.php +++ b/lib/User.php @@ -9,7 +9,6 @@ use function Safe\preg_match; * @property bool $IsRegistered A user is "registered" if they have an entry in the `Benefits` table; a password is required to log in. * @property Benefits $Benefits * @property string $Url - * @property bool $IsPatron * @property ?Patron $Patron * @property ?NewsletterSubscription $NewsletterSubscription */ @@ -30,7 +29,6 @@ class User{ protected array $_Payments; protected Benefits $_Benefits; protected string $_Url; - protected bool $_IsPatron; protected ?Patron $_Patron; protected ?NewsletterSubscription $_NewsletterSubscription; @@ -39,14 +37,6 @@ class User{ // GETTERS // ******* - protected function GetIsPatron(): bool{ - if(!isset($this->_IsPatron)){ - $this->GetPatron(); - } - - return $this->_IsPatron; - } - protected function GetNewsletterSubscription(): ?NewsletterSubscription{ if(!isset($this->_NewsletterSubscription)){ try{ @@ -64,16 +54,9 @@ class User{ if(!isset($this->_Patron)){ try{ $this->_Patron = Patron::Get($this->UserId); - if($this->_Patron->Ended === null){ - $this->IsPatron = true; - } - else{ - $this->IsPatron = false; - } } catch(Exceptions\PatronNotFoundException){ $this->_Patron = null; - $this->IsPatron = false; } } diff --git a/www/css/user.css b/www/css/user.css index 055691d0..cb425460 100644 --- a/www/css/user.css +++ b/www/css/user.css @@ -7,6 +7,10 @@ label:has(input[name="password-action"]) + label{ margin-top: .5rem; } +h2 + table{ + margin-top: .5rem; +} + table td{ padding: .5rem; vertical-align: top; diff --git a/www/users/get.php b/www/users/get.php index df1da786..fa8a2e77 100644 --- a/www/users/get.php +++ b/www/users/get.php @@ -78,13 +78,21 @@ catch(Exceptions\SeeOtherException $ex){ Is Patron: - IsPatron){ ?>☑ + Patron !== null && $user->Patron->Ended === null){ ?>☑ - IsPatron && $user->Patron !== null){ ?> + Patron !== null && $user->Patron->Ended === null){ ?> Created: Patron->Created->format(Enums\DateTimeFormat::FullDateTime->value) ?> + + Cycle type: + Patron->CycleType->value) ?> + + + Base cost: + $Patron->BaseCost) ?> + Is anonymous: Patron->IsAnonymous){ ?>☑