Fixes display of emails in profile edition.
authorStéphane Jacob <sj@m4x.org>
Mon, 19 Jul 2010 20:30:46 +0000 (22:30 +0200)
committerStéphane Jacob <sj@m4x.org>
Tue, 20 Jul 2010 08:49:59 +0000 (10:49 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/user.php
include/emails.combobox.inc.php
modules/profile/general.inc.php
modules/profile/jobs.inc.php

index 55d8d1a..38753cd 100644 (file)
@@ -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);
         }
index 7626b33..288aa66 100644 (file)
@@ -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";
 
index 55782e1..817b9a9 100644 (file)
@@ -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
index a61d179..507ffc0 100644 (file)
@@ -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");