Deleting an attachment from Glosssary Entry

Deleting an attachment from Glosssary Entry

by Matt Cromwell -
Number of replies: 2
Anyone know how to delete an attachment from a glossary entry?

I looked at the edit.php file. I'm no expert but I'm hoping that a simple:

else {
                'remove'($delete->attachment);
            }

might do the trick?
Any PHP pro's have any advice?
MC
Average of ratings: -
In reply to Matt Cromwell

Re: Deleting an attachment from Glosssary Entry

by L H -

The code would have to delete the $entry->attachment value and then also go off and delete the file itself which is in:

$CFG->dataroot/$course->id/moddata/glossary/$glossary->id/$entry->id/

or in actual terms something like:

moodledata/2/moddata/glossary/1/22/

Doing that is fine if off a button but from your code I assume you wanted it done if like:

(!empty ($entry->attachment)){

.....

} else {

delete statements

}

Which wouldnt work too well because entries that have attachments but dont want to change them (changing another field) would be effected