Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-3372

Can't delete an attachment from a forum post

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.6
    • Fix Version/s: 2.0
    • Component/s: Forum
    • Labels:
      None
    • Environment:
      Linux
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When one attaches a file to a forum post, there is a way to replace (by attaching another file), but there is no way to delete it (unless one goes into the moodle data directory - ordinary users can't do this of course).

      We are currently doing an some activities where learners need to attach files to forum posts, but sometimes they do it on the wrong post. It would be great is a feature could that added that would allow the file to be deleted.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            dougiamas Martin Dougiamas added a comment -

            From Darren Smith (dagza72 at gmail.com) Tuesday, 31 May 2005, 06:58 PM:

            I would prefer the detetion period to be the same as the 'cooling off' editing time

            From Timothy Allen (scop at hannam.ac.kr) Tuesday, 31 May 2005, 09:26 PM:

            I agree that there should be a time limit during which the attachment can be deleted and after which it cannot, as this is consistent with the rule for editing posts.

            Show
            dougiamas Martin Dougiamas added a comment - From Darren Smith (dagza72 at gmail.com) Tuesday, 31 May 2005, 06:58 PM: I would prefer the detetion period to be the same as the 'cooling off' editing time From Timothy Allen (scop at hannam.ac.kr) Tuesday, 31 May 2005, 09:26 PM: I agree that there should be a time limit during which the attachment can be deleted and after which it cannot, as this is consistent with the rule for editing posts.
            Hide
            dougiamas Martin Dougiamas added a comment -

            Assigning to me temporarily because Vy-Shane no longer works for Moodle HQ.

            Show
            dougiamas Martin Dougiamas added a comment - Assigning to me temporarily because Vy-Shane no longer works for Moodle HQ.
            Hide
            cttxg Teresa Gibbison added a comment -

            Is there any progress on this request? Is it possible for this to be an option for the teacher to set (allow attachment deletion)... I also think this should only be doable within the 30 minutes editing time and as long as someone hasn't replied.

            Show
            cttxg Teresa Gibbison added a comment - Is there any progress on this request? Is it possible for this to be an option for the teacher to set (allow attachment deletion)... I also think this should only be doable within the 30 minutes editing time and as long as someone hasn't replied.
            Hide
            cttxg Teresa Gibbison added a comment -

            Matt from Catalyst managed to enable us to delete attachments from a Dialogue (updated for 1.9) post via the edit link (I'm not sure if this will help here or not).

            Show
            cttxg Teresa Gibbison added a comment - Matt from Catalyst managed to enable us to delete attachments from a Dialogue (updated for 1.9) post via the edit link (I'm not sure if this will help here or not).
            Hide
            adamann2 Ann Adamcik added a comment -

            This is still an issue in 1.8.x and 1.9.x.

            Show
            adamann2 Ann Adamcik added a comment - This is still an issue in 1.8.x and 1.9.x.
            Hide
            drex Mark Drechsler added a comment -

            Just got off a help desk call about this problem - at least the info in the tracker meant I could say with confidence that it is a known issue

            Show
            drex Mark Drechsler added a comment - Just got off a help desk call about this problem - at least the info in the tracker meant I could say with confidence that it is a known issue
            Hide
            dougiamas Martin Dougiamas added a comment -

            In Moodle 2.0 this is already fixed. Basically forum posts etc will now:

            • allow any number of attachments to be added
            • allow any of these to be deleted (during post time or on re-edit).
            Show
            dougiamas Martin Dougiamas added a comment - In Moodle 2.0 this is already fixed. Basically forum posts etc will now: allow any number of attachments to be added allow any of these to be deleted (during post time or on re-edit).
            Hide
            dongsheng Dongsheng Cai added a comment -

            will be resolved in 2.0

            Show
            dongsheng Dongsheng Cai added a comment - will be resolved in 2.0
            Hide
            matteo Matteo Scaramuccia added a comment -

            Rough patch proposal for 1.9(.7):

            mod/forum/lib.php:

            --- lib.php.orig        Mon Feb 08 15:22:38 2010
            +++ lib.php     Mon Feb 08 15:25:32 2010
            @@ -3965,6 +3965,10 @@
                     unset($post->attachment);
                 }
             
            +    if (empty($post->attachment) && !empty($_POST['deleteattachment'])) {
            +        forum_delete_old_attachments($post);
            +    }
            +
                 if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
                     forum_tp_mark_post_read($post->userid, $post, $post->forum);
                 }

            mod/forum/post_form.php:

            --- post_form.php.orig  Sat Sep 26 17:25:48 2009
            +++ post_form.php       Mon Feb 08 16:01:14 2010
            @@ -61,7 +61,13 @@
                     if ($forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext))  {  //  1 = No attachments at all
                         $mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
                         $mform->setHelpButton('attachment', array('attachment', get_string('attachment', 'forum'), 'forum'));
            -
            +            // Note: on update some properties are not evaluated e.g. attachment
            +            if ($post->attachment) {
            +                $mform->addElement('checkbox', 'deleteattachment', get_string('attachment', 'forum') . ' ⇒ ' . get_string('delete', 'forum'));
            +                // Enhance the user experience
            +                $mform->disabledIf('deleteattachment', 'attachment', 'ne', '');
            +                $mform->disabledIf('attachment', 'deleteattachment', 'checked');
            +            }
                     }
             
                     if (empty($post->id) && has_capability('moodle/course:manageactivities', $coursecontext)) { // hack alert

            Show
            matteo Matteo Scaramuccia added a comment - Rough patch proposal for 1.9(.7): mod/forum/lib.php : --- lib.php.orig Mon Feb 08 15:22:38 2010 +++ lib.php Mon Feb 08 15:25:32 2010 @@ -3965,6 +3965,10 @@ unset($post->attachment); }   + if (empty($post->attachment) && !empty($_POST['deleteattachment'])) { + forum_delete_old_attachments($post); + } + if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) { forum_tp_mark_post_read($post->userid, $post, $post->forum); } mod/forum/post_form.php : --- post_form.php.orig Sat Sep 26 17:25:48 2009 +++ post_form.php Mon Feb 08 16:01:14 2010 @@ -61,7 +61,13 @@ if ($forum->maxbytes != 1 && has_capability('mod/forum:createattachment', $modcontext)) { // 1 = No attachments at all $mform->addElement('file', 'attachment', get_string('attachment', 'forum')); $mform->setHelpButton('attachment', array('attachment', get_string('attachment', 'forum'), 'forum')); - + // Note: on update some properties are not evaluated e.g. attachment + if ($post->attachment) { + $mform->addElement('checkbox', 'deleteattachment', get_string('attachment', 'forum') . ' ⇒ ' . get_string('delete', 'forum')); + // Enhance the user experience + $mform->disabledIf('deleteattachment', 'attachment', 'ne', ''); + $mform->disabledIf('attachment', 'deleteattachment', 'checked'); + } }   if (empty($post->id) && has_capability('moodle/course:manageactivities', $coursecontext)) { // hack alert

              People

              • Votes:
                13 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10