× Feature Requests

Please do NOT use this section of the forum to request help if Joomdle does not work for you in some particular way. Your post will be deleted.

Search Returns Hidden Courses/Categories/Topics

2 days 1 hour ago 2 days 1 hour ago by ncy. Reason: side note
ncy
Posts: 14
More
Topic Author
Search Returns Hidden Courses/Categories/Topics #1
When courses/categories/topics are hidden in Moodle, they should not come up in Joomdle search results. Currently, this is what shows when they shouldn't:
  1. Courses (Search types: any, exact)
  2. Categories (Search types: all, any, exact)
  3. Topics, when they are unhidden but their parent Course/Category is hidden (Search types: all, any, exact)
Some adjustments are needed in /auth/joomdle/auth.php.

Search courses:
public function search_courses ($text, $phrase, $ordering, $limit) {
    ...
    default:
         ...
        break;
    }
+   $where = '(' . $where . ') AND co.visible = 1'; // The check for co.visible is also in the SQL query, so either here or there. Main change is adding parentheses.

Search categories:
public function search_categories ($text, $phrase, $ordering, $limit) {
    ...
    default:
         ...
        break;
    }
+   $where = '(' . $where . ') AND ca.visible = 1'; // The check for ca.visible is not in SQL query

Search topics:
public function search_topics ($text, $phrase, $ordering, $limit = 50) {
    ...
    default:
         ...
         break;
    }
-    $where .= " and cs.visible = 1";
+    $where = '(' . $where . ') AND cs.visible = 1 AND co.visible = 1'; // Need parentheses, and the check for cs.visible and co.visible is not in SQL query

Side note, while testing I discovered that searching for the word "topic" will ignore course sections that do not have a custom title set, even though they are automatically labeled as "Topic X" by Moodle. I guess that's because technically those titles are blank.
Cron Job Starts