mod/book:edit capabilitiy and "Turn editing on" button

mod/book:edit capabilitiy and "Turn editing on" button

by Nicolas Dunand -
Number of replies: 0
Picture of Core developers Picture of Plugin developers

Hello,

My problem is that we want to have one book, that could be editable by students. I noticed the "mod/book:edit" capability indeed renders the book editable but fails to display the "Turn editing on" button, hence preventing book editing.

In the code (lib.php, function book_edit_button), the visibility of this button is controlled by :

if (isteacheredit($courseid)) {

which I replaced by

$context = get_context_instance(CONTEXT_MODULE, $id);
$allowedit = has_capability('mod/book:edit', $context);
if ($allowedit) {

Is the code wrong, or am I ?

Many thanks for any views/thoughts on this.

Average of ratings: -