-
Bug
-
Resolution: Not a bug
-
Minor
-
1.9.2
-
None
-
MOODLE_19_STABLE
-
MOODLE_19_STABLE
-
Easy
i set a user to be an Admin (role) on some category and tried to use
that user to add new sub categories under that category... and was not able to.
i was keep getting the "add new category" page filled with what i defined previously
but i could not submit it.
to solve this issue i had to:
open course/editcategory_form.php and change line 28 from:
$mform->addElement('hidden', 'id', null);
to:
$mform->addElement('hidden', 'id', $this->_customdata['id']);
and open course/editcategory.php and change line 69 from :
if (empty($category) && has_capability('moodle/category:create', $context)) { // Create a new category
to:
if (empty($category) && has_capability('moodle/category:create', get_context_instance(CONTEXT_COURSECAT, $id,$USER))) { // Create a new category
and line 75 from :
redirect('index.php?categoryedit=on');
to:
redirect('category.php?id='.$id.'&categoryedit=on');
it was not passing the category id to the form and it was not checking
the capabilities against the specific user in that specific category.
as far as i can tell.
now it works fine