Customizing 'course creator' visibility

Customizing 'course creator' visibility

by Mike Mike -
Number of replies: 4
Hi everyone!

I've been busy making some necessary code-hacks to our moodle installation. I'm stuck on one problem, which I'm not sure if it is a bug or needs a code modification.

This is predominantly for our main-menu block, but could be applicable in other areas. There is a checkbox that allows you to choose whether a resource is 'visible to students'. But when you set it to not-visible it also hides the resource for course creators. That is not the functionality that we need. We need them to be visible to admins AND course creators, but not students.

Unfortunately, I'm still getting used to the code-structure of moodle. I was hoping someone would have some good ideas as to which files/directories I might look in to amend this functionality. Or in other words, where does that visibility option get checked, so that I can throw in a 'course creator' option.

Thanks,

Mike.
Average of ratings: -
In reply to Mike Mike

Re: Customizing 'course creator' visibility

by Shane Elliott -
Picture of Core developers Picture of Plugin developers
May just be simpler to upgrade to version 1.7 and use the new roles system to achieve what you want.
In reply to Shane Elliott

Re: Customizing 'course creator' visibility

by Mike Mike -
I didn't think 1.7 was ready for a production server...
In reply to Mike Mike

Re: Customizing 'course creator' visibility

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It nearly is. It would be better to use/wait for it than to hack 1.6, believe me. smile
In reply to Mike Mike

Re: Customizing 'course creator' visibility

by Timothy Takemoto -

Mike Mike

Should you wish to go for the hack, perhaps becuase you have already made various hacks and don't want to have to hack all over again, or just for interest's sake then...

The problem is that this "hidden" setting is spread around various parts of moodle.

For the main site menu see
moodle/blocks/site_main_menu/block_site_main_menu.php
around line 31
        $isteacher = isteacher($this->instance->pageid);
which is used on around line 83
                if ($mod->visible || $isteacher) {
I think that *perhaps* 
        $isteacher = iscoursecreator();
or *perhaps* 
        $isteacher = iscoursecreator($this->instance->pageid);
or, for all teachers
        $isteacher = isteacherinanycourse();
may work, but I have not tried any of these.

I stress, that this is just out of interest, and it may well be better to upgrade to moodle 1.7 (which has roles, Ajax and lots more), and with all caveats about the dangers of hacking your moodle.

Timothy