diff options
| author | Syndamia <kamen@syndamia.com> | 2025-02-02 13:43:26 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-02-02 13:43:26 +0200 |
| commit | 0e4f90e6a82f0fc275d65bf0e4f4c2842052dde9 (patch) | |
| tree | 892ccf952d364f03734ed95950845037fef26179 /models | |
| parent | 168abc2c8512343f2a65461c6791ae852ae64665 (diff) | |
| download | nowayforward_human-0e4f90e6a82f0fc275d65bf0e4f4c2842052dde9.tar nowayforward_human-0e4f90e6a82f0fc275d65bf0e4f4c2842052dde9.tar.gz nowayforward_human-0e4f90e6a82f0fc275d65bf0e4f4c2842052dde9.zip | |
feat(views/user): Implement account deletion
Diffstat (limited to 'models')
| -rw-r--r-- | models/user.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/models/user.php b/models/user.php index 9b76f37..1f58e7c 100644 --- a/models/user.php +++ b/models/user.php @@ -57,4 +57,30 @@ class User extends Table { include $VIEWS_DIR . '/img/user-star.svg'; } } + + private static $AnonUID = 1; + + function delete() { + // Applicable to Anon user + if ($this->Password === '') { + throw new Exception('Not deleting system account!'); + } + + Table::_update( + 'Webpages', + 'RequesterUID = "' . self::$AnonUID . '"', + "RequesterUID = \"$this->UID\"" + ); + + Table::_update( + 'ArchiveLists', + 'AuthorUID = "' . self::$AnonUID . '"', + "AuthorUID = \"$this->UID\"" + ); + + Table::_delete( + 'Users', + "UID = \"$this->UID\"" + ); + } } |
