From 8d308ee4586dab8103b55b88ad808e679ac799a5 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Wed, 23 Jun 2010 10:12:19 +0200 Subject: [PATCH] Change the email format directly via the User object to ensure the changes are immediately taken into account (Closes #1112) Signed-off-by: Florent Bruneau --- classes/user.php | 14 ++++++++++++++ modules/platal.php | 5 +---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/classes/user.php b/classes/user.php index c69e234..9b1d41e 100644 --- a/classes/user.php +++ b/classes/user.php @@ -405,6 +405,20 @@ class User extends PlUser } + /** Format of the emails sent by the site + */ + public function setEmailFormat($format) + { + Platal::assert($format == self::FORMAT_HTML || $format == self::FORMAT_TEXT, + "Invalid email format \"$format\""); + XDB::execute("UPDATE accounts + SET email_format = {?} + WHERE uid = {?}", + $format, $this->uid); + $this->email_format = $format; + } + + /** Get watch informations */ private function fetchWatchData() diff --git a/modules/platal.php b/modules/platal.php index 197728e..2ad9317 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -132,10 +132,7 @@ class PlatalModule extends PLModule if (Post::has('email_format')) { $fmt = Post::s('email_format'); - XDB::execute("UPDATE accounts - SET email_format = {?} - WHERE uid = {?}", - $fmt, S::v('uid')); + S::user()->setEmailFormat($fmt); S::set('email_format', $fmt); } -- 2.1.4