Fix medals fetching for Profiles
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 22 Mar 2010 08:30:34 +0000 (09:30 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 22 Mar 2010 13:07:56 +0000 (14:07 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/profilefields.inc.php

index 815b438..1bbb91a 100644 (file)
@@ -380,15 +380,16 @@ class ProfileMedals extends ProfileField
     {
         $this->pid = $it->value();
         while ($medal = $it->next()) {
-            $this->medals[$medal['mid']] = $medal['gid'];
+            $this->medals[$medal['mid']] = $medal;
         }
     }
 
     public static function fetchData(array $pids, $visibility)
     {
-        $data = XDB::iterator('SELECT  pm.pid, pm.mid, pm.gid
+        $data = XDB::iterator('SELECT  pm.pid, pm.mid, pm.gid, pme.text, pme.img
                                  FROM  profile_medals AS pm
                             LEFT JOIN  profiles AS p ON (pm.pid = p.pid)
+                            LEFT JOIN  profile_medal_enum AS pme ON (pme.id = pm.mid)
                                 WHERE  pm.pid IN {?} AND p.medals_pub IN {?}
                              ORDER BY  ' . XDB::formatCustomOrder('pm.pid', $pids),
                                 $pids, $visibility);