Me neither, Ron. I've looked everywhere I can think of including the Tracker. Possibly needs a feature request.
Thanks.
I have a solution for part of the problem- I didn't want non-teaching course creating staff to be listed with each course, but I did want to have course creators.
The patch I have made simply means that the role "Course creator" is not listed.
You could of course create a new role with "name" and change the patch to omit "name" roles.
Edit /course/lib.php (v 1.446.2.7 2007/01/08)
insert line 1563 If ($role->name != "Course creator"){
insert line 1567 }
so that the foreach loop now looks like:
foreach ($teachers as $teacher) {
if (!$teacher->hidden || $canseehidden) {
$roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
$role = array_shift($roles); // First one
mtrace($role->name);
If ($role->name != "Course creator"){
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
}
}
}
Now you can asign course creators at the site level and they don't get listed with the courses
If anyone knows what the '$teacher->hidden ' parameter is supposed to do, would be nice toknow...
Can you ftp into your site? You'll need log, password etc. And and ftp client.
This is my code:
foreach ($teachers as $teacher) {
if (!$teacher->hidden || $canseehidden) {
$roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
$role = array_shift($roles); // First one
mtrace($role->name);
If ($role->name != "Course creator"){
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($role->name).': wwwroot.'/user/view.php?id='.
$teacher->id.'&course='.SITEID.'">'.$fullname.'';
}
}
}
I think it looks the same, am I wrong? Do in need to do anything to initiate the change? Thanks!
Hi Russell.
Do you get any ouput? I've just noticed the call to mtrace is still in the code. Once everything is working it should be deleted. But while it is there you should see every listed teacher's role twice.
If your not, perhaps your modifying a file that's not active?
I notice that your teacher link is not a hyperlink - but I don't see why that should make any difference.
Regards Chris
I'm not sure I know what you mean by output?
I'm also not sure what you mean when you say "should see every listed teachers role twice" I still only see the teachers listed once in each course. I have tried it with and without the mtrace.
I'm sure I'm modifying the correct moodle site, am I modifying the wrong file within the site?
any other thoughts??
Thanks, Rusty
Russell,
The file is course/lib.php. I have created some courses in Miscellaneous, when i click on the miscellaneous catagory the courses are listed on my screen, each course in a separate box. The teacher/creators are listed in each box.
With the mtrace call in as shown you should see the role of the person listed just before each box - so you see the role twice.
If in doubt insert something like
mtrace("line number xxx ");
You should see this on your screen when the codse is executed. If you don't then you are editing the wrong bit of code (imho).
Rgds Chris
Before:
foreach ($teachers as $teacher) {
if (!$teacher->hidden || $canseehidden) {
$roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
$role = array_shift($roles); // First one
If ($role->name != "Course creator"){
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($role->name).': '.$fullname.'';
}
}
}
After:
foreach ($teachers as $teacher) {
if (!$teacher->hidden || $canseehidden) {
$roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
$role = array_shift($roles); // First one
If ($role->name != "Administrator"){
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($role->name).': '.$fullname.'';
}
}
}
Don't know if that will help you, I don't know much about moodle code.
It doesn't work for me though.
Good Luck!
Really the problem, I think, is due to the language used in the installation. If you look in the data-base table "mdl_role" you can see the real name assigned to each role. In italian we have "Creatori di corsi" not "Course creators". Anyway the best thing to do is to look at the number of the role we want to skip in the list, in my case I want to skip the Course creators (usually id=2) and a new role I creted (id=7). The code is now:
foreach ($teachers as $teacher) {
If ($teacher->id != 7 && $teacher->id != 2){
if (!$teacher->hidden || $canseehidden) {
$roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
$role = array_shift($roles); // First one
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
}
}
}
Good luck!
Hi
I am sure this is out of context but we are using moodle 1.7+. We have created a few courses and we would like to use one of the courses in a different format and hence we would like to hide them from general enrollment but make it available via a drop down on the homepage. Is there a way to avoid making it enrollable/available on the All courses list? We tried hiding it but what happened was that it was not available to students completely.
To clarify we are using the same course in a new format but with lesser number of items. Also on the course there is a number displayed for each section is there a way I can hide this auto number?
Regards
Uday