Merge branch 'platal-1.0.0'
[platal.git] / include / emails.combobox.inc.php
index 3d9a09f..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";
 
@@ -70,7 +73,7 @@ function fill_email_combobox(PlPage& $page, $user = null, $profile = null)
         $res = XDB::query(
                 "SELECT  alias
                    FROM  aliases
-                  WHERE  id={?} AND (type='a_vie' OR type='alias')", $user->id());
+                  WHERE  uid={?} AND (type='a_vie' OR type='alias')", $user->id());
         $res = $res->fetchAllAssoc();
         $page->assign('list_email_X', $res);
         if (($domain == $globals->mail->domain) || ($domain == $globals->mail->domain2)) {