Good day for everyone. I need to replace the old function get_and_set_current_group() with new equivalent. Using moodle search and google I only have found information that it's deprecated. Can you tell me how I should replace it?
This is a fragment of code;
GLOBAL $cm,$course,$CFG,$USER;
if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
print_error('badcontext');
}
$changegroup = optional_param('group', -1, PARAM_INT); // choose the current group
$groupmode = groupmode($course,$cm);
$currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
Thanks!