Fixes display of comments on disabled accounts (Closes #1126).
[platal.git] / modules / profile.php
index 1527e85..d7cd55f 100644 (file)
@@ -253,9 +253,9 @@ class ProfileModule extends PLModule
         $page->changeTpl('profile/profile.tpl', SIMPLE);
 
         // Determines the access level at which the profile will be displayed.
-        if (!S::logged() || Env::v('view') == 'public') {
+        if (!S::logged() || !S::user()->checkPerms('directory_ax') || Env::v('view') == 'public') {
             $view = 'public';
-        } else if (S::logged() && Env::v('view') == 'ax') {
+        } else if (!S::user()->checkPerms('directory_private') || Env::v('view') == 'ax') {
             $view = 'ax';
         } else {
             $view = 'private';
@@ -654,7 +654,7 @@ class ProfileModule extends PLModule
         $joins = JobTerms::token_join_query($tokens, 'e');
         if ($type == 'mentor') {
             $count = ', COUNT(DISTINCT pid) AS nb';
-            $countjoin = ' LEFT JOIN  profile_job_term_relation AS r ON(r.jtid_1 = e.jtid) LEFT JOIN  profile_mentor_term AS m ON(r.jtid_2 = m.jtid)';
+            $countjoin = ' INNER JOIN  profile_job_term_relation AS r ON(r.jtid_1 = e.jtid) INNER JOIN  profile_mentor_term AS m ON(r.jtid_2 = m.jtid)';
             $countorder = 'nb DESC, ';
         } else {
             $count = $countjoin = $countorder = '';