}
     if (!isset($fromform->setimportant)) {
         $fromform->setimportant = false;
     }
     if (!isset($fromform->format)) {
         $fromform->format = 0;
     }
     $attachments = array();
     if (!empty($fromform->attachmentplayspace)) {
         $deleteattachments = true;
         $attachments = forum::get_attachment_playspace_files($fromform->attachmentplayspace, optional_param('keepplayspace', 0, PARAM_INT));
     } else {
         // Attachments are saved initially into a temp folder, then
         // moved into place
         $uploadfolder = $CFG->dataroot . '/moddata/forumng/uploads/' . $USER->id . ',' . mt_rand();
         $mform->save_files($uploadfolder);
         if (is_dir($uploadfolder)) {
             $handle = opendir($uploadfolder);
             while (false !== ($item = readdir($handle))) {
                 if ($item != '.' && $item != '..') {
                     $attachments[] = $uploadfolder . '/' . $item;
                 }
             }
             closedir($handle);
         }
         // Get list of attachments to delete
         $deleteattachments = array_key_exists('deletefile', $_POST) ? $_POST['deletefile'] : array();
     }
 }
 if ($isdiscussion) {
     if (!isset($fromform->timestart)) {