I'm trying to add Availability Condition to a Module. When a single condition is added, the change is made effective. Instead when I add more than one condition, they are visible into the settings page of the module, but the conditions are not effective. My source code is the following:
$json = json_decode($quizavailability);
$entry = array();
$entry['type'] = "profile";
$entry['sf'] = "idnumber";
$entry['op'] = "isequalto";
$entry['v'] = $userid;
array_push( $json->{'c'}, $entry);
$treejson = \core_availability\tree::get_root_json(
$json->{'c'},
\core_availability\tree::OP_OR,
false
);
$DB->set_field('course_modules', 'availability', json_encode($treejson), array('id' => $quizid));
rebuild_course_cache();