In survey results, clusters all empty comments for free text
[platal.git] / classes / profile.php
index fec4cfc..d75bf76 100644 (file)
@@ -796,8 +796,9 @@ class Profile
                                      p.nationality1, p.nationality2, p.nationality3,
                                      IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
                                      pe.entry_year, pe.grad_year,
-                                     IF ({?} IN {?}, pse.text, NULL) AS section,
-                                     pn_f.name AS firstname, pn_l.name AS lastname, pn_n.name AS nickname,
+                                     IF ({?}, pse.text, NULL) AS section,
+                                     pn_f.name AS firstname, pn_l.name AS lastname,
+                                     IF( {?}, pn_n.name, NULL) AS nickname,
                                      IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary,
                                      IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary,
                                      pd.yourself, pd.promo, pd.short_name, pd.directory_name AS full_name,
@@ -829,8 +830,10 @@ class Profile
                            GROUP BY  p.pid
                                      ' . $order,
                            $visibility->levels(),
-                           ProfileVisibility::VIS_PRIVATE, $visibility->levels(),
-                           $visibility->levels(), $visibility->levels(),
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
+                           $visibility->levels(),
+                           $visibility->levels(),
                            $pids
                        );
         return new ProfileIterator($it, $pids, $fields, $visibility);