General help

 
 
Picture of Gisela Salgado
Re: Hiding courses and categories to unenrolled users
 

Hi Jaimie. I'm trying to follow all your instructions but I have problems finding the blocks you mentioned. I've already installed flex page, but cannot find the site where I can download the other 2 blocks (profile redirect and courses available). The only stuff I've found are manuals. Can you help me aout with this? Please?...

 
Average of ratings: -
Picture of marina g
Re: Hiding courses and categories to unenrolled users
 

Hi guys, I'm having the same issue, we are using Moodle 2.4.6, and we have students that enroll on a course, but then they are able to see all the other courses that they are NOT enrolled in. How do i hide those courses from them?

PS: am 100% new to moodle

Thanks

M

 
Average of ratings: -
Picture of marina g
Re: Hiding courses and categories to unenrolled users
 

BTW: i think i have tried everything, spent 2 hours playing around with the settings, hiding courses, changing permissions, all to no avail.. please HELP

 
Average of ratings: -
no me
Re: Hiding courses and categories to unenrolled users
 

This tweek is for Moodle 2.6 and may work with 2.x

In my moodle units are displayed as 'Combo list'. So if you have a different setting you might have to adapt the code.

Script file to edit course/renderer.php

To hide units that users have no access to

This bit is easy and straightforward. You simply have to add a line of code

in function coursecat_courses(...)

    in foreach ($courses as $course) {

         if($course->can_access()) // add this line
                $content .= $this->coursecat_coursebox($chelper, $course, $classes); // just before this line

 

To hide categories with no accessable units

This part is a bit tricky. The function coursecat_category_content() returns HTML code that is placed under each category. What I look for here is if there is any units in that block. Each unit is wrapped in a div tag with a class 'coursebox'. So we search for this and if found concludes that this category has units and hence display it. The code is added in 3 parts of the function.

in function coursecat_category(...)
$hidecat = false; // add this in the beginning
.
.
.
// load category content
$categorycontent = $this->coursecat_category_content($chelper, $coursecat, $depth); // under this line
if(strpos($categorycontent,'coursebox')===false) // add this two lines
     $dol_hidecat = true; // and this line too
.
.
.
if($dol_hidecat)  // just before the return an the end of the function, add this two lines
    $content = '';
return $content;

 

 
Average of ratings: -