From 4e698dc96a386e833713ca9004121ca857418d30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 19 Jul 2010 22:30:46 +0200 Subject: [PATCH] Fixes display of emails in profile edition. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/user.php | 4 ++-- include/emails.combobox.inc.php | 7 +++++-- modules/profile/general.inc.php | 2 +- modules/profile/jobs.inc.php | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/classes/user.php b/classes/user.php index 55d8d1a..38753cd 100644 --- a/classes/user.php +++ b/classes/user.php @@ -314,9 +314,9 @@ class User extends PlUser /** Return the main profile attached with this account if any. */ - public function profile() + public function profile($forceFetch = false) { - if (!$this->_profile_fetched) { + if (!$this->_profile_fetched || $forceFetch) { $this->_profile_fetched = true; $this->_profile = Profile::get($this); } diff --git a/include/emails.combobox.inc.php b/include/emails.combobox.inc.php index 7626b33..288aa66 100644 --- a/include/emails.combobox.inc.php +++ b/include/emails.combobox.inc.php @@ -23,9 +23,12 @@ function fill_email_combobox(PlPage& $page, $user = null, $profile = null) { global $globals; - if (is_null($user) && is_null($profile)) { + if (is_null($user)) { $user = S::user(); - $profile = $user->profile(); + } + if (is_null($profile)) { + /* Always refetch the profile. */ + $profile = $user->profile(true); } $email_type = "directory"; diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 55782e1..817b9a9 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -662,7 +662,7 @@ class ProfileSettingGeneral extends ProfilePage $page->assign('edu_fields', $res->fetchAllAssoc()); require_once "emails.combobox.inc.php"; - fill_email_combobox($page, $this->owner, $this->profile); + fill_email_combobox($page, $this->owner); $res = XDB::query("SELECT nw.nwid AS type, nw.name FROM profile_networking_enum AS nw diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index a61d179..507ffc0 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -513,7 +513,7 @@ class ProfileSettingJobs extends ProfilePage public function _prepare(PlPage &$page, $id) { require_once 'emails.combobox.inc.php'; - fill_email_combobox($page, $this->owner, $this->profile); + fill_email_combobox($page, $this->owner); $res = XDB::query("SELECT id, name AS label FROM profile_job_sector_enum"); -- 2.1.4