$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';
$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 = '';