Teacher does not see their hidden courses or inside hidden categories

Teacher does not see their hidden courses or inside hidden categories

by Ângelo Rigo -
Number of replies: 8
Hi

We are using moodle 1.9.3 and in the teacher permissions, moodle/course:viewhiddencourses is set to allow, but the teachers are not seeing their courses if they are hidden.

They do not see even if they are visible but inside a hidden category, we have the moodle/category:viewhiddencategories capability set to allow.

Also they do not see the hidden course inside a hidden category.

I would like the teachers to see their hidden courses and the courses inside a hidden category the two capabilities responsable .

How can it be done ?

Thank´s in advance
Average of ratings: -
In reply to Ângelo Rigo

Re: Teacher does not see their hidden courses or inside hidden categories

by Alan Zaitchik -
So glad to know someone else is seeing this. mixed
I thought I was going crazy! Here are links to threads that I posted my questions in, but without a solution. There were some good suggestions what to look at, but it seems that you already have done so.


What build are you using of 1.9.3 ? At first I wrongly thought the problem was only in the recent build of 2008-12-24 but now I see it in 2008-12-10 as well. I cannot check further back. This is a showstopper for us since I cannot set the courses to visible before instructors set them up with appropriate content, and the student enrollments are processed at about the same time as the instructor assignments in many cases, i.e. as students are registered in an external SIS.

Alan


In reply to Alan Zaitchik

Re: Teacher does not see their hidden courses or inside hidden categories

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Do either of you know enough about PHP programming to walk through what happens when a teacher hits course/view.php?

I suspect the problem occurs in the require_login function, and depends on one of your settings, because I still cannot reproduce it.

What you probably need to do (on a copy of your site) is to add debugging statements to see how far it gets.

Actually, to start with, what error message does the teacher see when they try to access the course? that might tell us where the problem occurs.
In reply to Tim Hunt

Re: Teacher does not see their hidden courses or inside hidden categories

by Alan Zaitchik -
I put some debug statements in relevant portions of the require_login function in moodlelib.php (around line 1989 in the code from the 2008-12-10 build) and found the following:

1. For a manually created hidden course to which I manually assigned the teacher, the teacher HAD the viewhiddencourses capability and was able to enter the course.
2. For a hidden course created automatically by the external database plugin (/enrol/database/enrol_database_sync.php)1, to which the teacher was assigned by that same plugin, the same teacher LACKED the viewhiddencourses capability and could not enter the course. The error message, as expected, was that "the course is currently unavailable to students".

This makes me think that something is not set up correctly when the teacher enrolment is handled, despite the fact that the teacher SEEMS to have the "legacy" editingteacher role and the latter has the various "view courses" and "viewhiddencourses" capabilities.

Hope this help.

Alan


1. I changed the code in enrol/database/enrol.php so that the new course does not automatically get set to visible. It thus inherits the visibility setting of the template course, which is set to invisible.
In reply to Alan Zaitchik

Re: Teacher does not see their hidden courses or inside hidden categories

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Great work. So it is looking like it really is an enrolment issues, to do with it not creating the right set-up during enrolment, rather than a problem with processing that set-up when the teacher tries to go into the course.

I don't know very much about enrolment plugins. I would assume that they just create role assignments and possibly courses. Again, you probably need to put some debugging in there, to see what they are actually doing.
In reply to Tim Hunt

Re: Teacher does not see their hidden courses or inside hidden categories

by Ângelo Rigo -
Hi

I have a copy of the production site an can work with PHP debugging to see what happens.

My problem was the allowvisiblecoursesinhiddencategories on the frontpage that is solved now .

I can help to reproduce some other related issue, please just tell me what variables i have to track.

Cheers
In reply to Ângelo Rigo

Re: Teacher does not see their hidden courses or inside hidden categories

by Alan Zaitchik -
Angelo,
I tried setting the Front Page setting as you did but still the instructors do not see their courses listed on the Front Page. Also, when I use the direct URL straight into the course (/course/view.php?id=46) I get the "This course is currently unavailable to students". As noted above, however, the instructors are listed as the teachers of the courses and I confirmed this in MySQL: they have the role of editingteacher assigned for their courses.
The category of the course is Miscellaneous, which is not really hidden anyway. But for good measure I went into the Users > Permissions > Define Roles and gave Teachers (editingteachers) every capability that seemed relevant-- no luck!
Could I ask you this:
1. what specific build of 1.9.3 are you using? (I mean the build date recorded in the version.php file in the Moodle root directory.)
2. are you creating courses and assigning roles through the external database plugin, or through someother mechanism. I am wondering if the fact that I autocreate the courses is relevant, or if the fact that the editingteacher role is assigned through the external db enrolment plugin is relevant.
As you can see I am groping in the dark. But it is getting to be a desperate situation as I need some solution almost immediately!
Alan

In reply to Ângelo Rigo

Re: Teacher does not see their hidden courses or inside hidden categories

by Ângelo Rigo -
Hi

We set on the frontpage allowvisiblecoursesinhiddencategories to yes and now the teachers can see their courses.



In reply to Ângelo Rigo

Eureka, sort of...

by Alan Zaitchik -
Here is the problem I faced/created, as far as I have been able to determine. It is "solved" in all practical terms, but I am not sure why.

The problem was that when I decided to change the code in enrol/database/enrol.php so that the autocreated course would not be set to visible but would instead (so I thought) "inherit" the visibility setting (0) of the template course I am using, what ended up happening is... well, the new autocreated course ended up with visible=0 as far as MySQL was concerned but clearly was not "fully" set up "correctly". Thus editing Teachers could not see it or access it, despite the fact that the role of editing Teacher really did have the capabilities in question. When I explicitly added a line to enrol.php
$course->visible = 0;
then all was well. I am still not sure how this makes any sense, but those are the facts. I suppose I could spend some time studying the code which actually creates all the course-related tables but for now the fix seems to be: if you are using a template course and the external database plugin and want the autocreated courses to be invisible to students then be sure to explicitly make them so by adding the above line to enrol.php (around line 640 in my 1.9.3 release).

Alan