From: Stéphane Jacob Date: Mon, 19 Jul 2010 20:30:46 +0000 (+0200) Subject: Fixes display of emails in profile edition. X-Git-Tag: xorg/1.0.1~311 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=4e698dc96a386e833713ca9004121ca857418d30;p=platal.git Fixes display of emails in profile edition. Signed-off-by: Stéphane Jacob --- 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");