Skip to content

Commit

Permalink
Changed context set_item_tags to that of the question
Browse files Browse the repository at this point in the history
Previously it was always being set to system, which was both
wrong and it triggered an error when attempting edit a question
  • Loading branch information
marcusgreen committed Oct 3, 2024
1 parent 31ccbc6 commit 715f7af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public static function bulk_tag_questions($fromform) {
WHERE q.id
{$usql}";
$questions = $DB->get_records_sql($sql, $params);

foreach ($questions as $question) {
if (!$fromform->replacetags) {
$existingtags = \core_tag_tag::get_item_tags('core_question', 'question', $question->id);
foreach ($existingtags as $tag) {
$tags[] = $tag->get_display_name();
}
}
\core_tag_tag::set_item_tags('core_question', 'question', $question->id, \context_system::instance(), $tags);
$context = \context::instance_by_id($question->contextid);
\core_tag_tag::set_item_tags('core_question', 'question', $question->id, $context, $tags);
}

}
Expand Down

0 comments on commit 715f7af

Please sign in to comment.