From e542afc952284343a11aaaffb1e4ad50a6ea1237 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 13 Jul 2014 12:16:57 +0200 Subject: [PATCH] [UPDATE] Hide e-mail address on account screen --- include/classes/user.class.php | 5 ++++- templates/bootstrap/account/edit/detail.tpl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/classes/user.class.php b/include/classes/user.class.php index ec672517..91172e90 100644 --- a/include/classes/user.class.php +++ b/include/classes/user.class.php @@ -496,7 +496,7 @@ class User extends Base { $this->setErrorMessage('Donation above allowed 100% limit'); return false; } - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + if ($email != 'hidden' && $email != NULL && !filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->setErrorMessage('Invalid email address'); return false; } @@ -540,6 +540,9 @@ class User extends Base { } } + // If we hide our email or it's not set, fetch current one to update + if ($email == 'hidden' || $email == NULL) + $email = $this->getUserEmailById($userID); // We passed all validation checks so update the account $stmt = $this->mysqli->prepare("UPDATE $this->table SET ap_threshold = ?, donate_percent = ?, email = ?, timezone = ?, is_anonymous = ? WHERE id = ?"); if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) { diff --git a/templates/bootstrap/account/edit/detail.tpl b/templates/bootstrap/account/edit/detail.tpl index 582deb94..a59574b1 100644 --- a/templates/bootstrap/account/edit/detail.tpl +++ b/templates/bootstrap/account/edit/detail.tpl @@ -28,7 +28,7 @@ {/if}
- {nocache}{/nocache} + {nocache}{/nocache}