Skip to content

Commit

Permalink
Hide author of files in anonymous posts
Browse files Browse the repository at this point in the history
  • Loading branch information
justusdieckmann committed Jan 15, 2024
1 parent 867cfa4 commit b42ae5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions post.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@
empty($post->id) ? null : $post->id,
mod_moodleoverflow_post_form::attachment_options($moodleoverflow));

if ($draftitemid && $edit && \mod_moodleoverflow\anonymous::is_post_anonymous($discussion, $moodleoverflow, $post->userid) && $post->userid != $USER->id) {
$usercontext = context_user::instance($USER->id);
foreach (get_file_storage()->get_area_files($usercontext->id, 'user', 'draft', $draftitemid) as $file) {
$file->set_author('Anonymous');
}
}

// Prepare the form.
$formarray = array(
'course' => $course,
Expand Down

0 comments on commit b42ae5f

Please sign in to comment.