Can HTML editor be disabled for users, but enabled for course creators?

Can HTML editor be disabled for users, but enabled for course creators?

by info com -
Number of replies: 4
Hi

As a course creator its good to have HTML editor to format the questions etc, but for the textarea answers (essay answers) during a quiz for example, I dont want the user able to format the answer so want to disable the HTML editor for a user, but enable it for Admin. Is this possible?

Thanks
Laurie
Average of ratings: -
In reply to info com

Re: Can HTML editor be disabled for users, but enabled for course creators?

by info com -
P.S. Another reason for this is because if you have 2 essay answers on the same page, and HTML is enabled, the first box shows the editor buttons, but the second doesn't. I suspect this is to do with Javascript used to create the HTML editor, so this is another reason to turn it off.
In reply to info com

Re: Can HTML editor be disabled for users, but enabled for course creators?

by info com -
Hi. Does anyone have an idea about this?

Should I just hack the front end code to remove HTML editor but leave it for Admin?
In reply to info com

Re: Can HTML editor be disabled for users, but enabled for course creators?

by info com -
Sorry, but have to ask again, its important for me. Anyone know if I can turn off HTML for Users, but still have it for Admin to create courses?

Thanks
In reply to info com

Re: Can HTML editor be disabled for users, but enabled for course creators?

by Mauno Korpelainen -

Try to edit moodlelib.php with WordPad (not with notepad) and find function can_use_html_editor

For example:

function can_use_html_editor() {

global $USER, $CFG;

$sysctx = get_context_instance(CONTEXT_SYSTEM);

if (!empty($USER->htmleditor) and !empty($CFG->htmleditor) and (has_capability('moodle/site:config', $sysctx))) {

if (check_browser_version('MSIE', 5.5)) {

return 'MSIE';

} else if (check_browser_version('Gecko', 20030516)) {

return 'Gecko';

}

}

return false;

}

should work (or try some other role setting instead of 'moodle/site:config')

If you use for example

moodle/course:create

it will give all course creators editor.

TAKE A BACKUP COPY OF MOODLELIB.PHP BEFORE CHANGING IT!