diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 3147f455eac..c2ad1613ee3 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2965,10 +2965,14 @@ class assign { $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_'); } - $subtype = $plugin->get_subtype(); - $type = $plugin->get_type(); - $prefix = $prefix . $subtype . '_' . $type . '_'; - + // Only prefix files if downloadasfolders user preference is NOT set. + if (!get_user_preferences('assign_downloadasfolders', 1)) { + $subtype = $plugin->get_subtype(); + $type = $plugin->get_type(); + $prefix = $prefix . $subtype . '_' . $type . '_'; + } else { + $prefix = ""; + } $result = str_replace('@@PLUGINFILE@@/', $prefix, $text); return $result;