1

I´m using for the first time Guest Entries plugin to collect some info and some files from users, great! All it´s going great, the site admin will see all the info that the clients sends and the files from each one, but i would like to know if there is a way to download the assets from a specific entry, so keep it simple to download the assets sended by some specific user.

enter image description here

Something like this plugin does, but it doesn´t work. https://github.com/Hambrook/AssetLinks

I found this one too, but it downloads the assets of a entire source. https://github.com/mattstauffer/craftcms-DownloadAssets

Any help? Thanks!

Robin Schambach
  • 19,713
  • 1
  • 19
  • 44
Sebastian
  • 25
  • 4

1 Answers1

1

Change the javascript of the asset file to something like this and it will work

$(function(){
    $(".field .input .elementselect .element:not(.linked)").each(function(){
        var $this = $(this);
        if (!$this.data("url")) { return false; }
        var $a = $("<a class='icon'> </a>")
            .attr("href", $this.data("url"))
            .attr("title", "Download")
            .addClass("download")
            .addClass("sharebtn")
            .addClass("icon")
            .attr('download', $this.data('label'))
            .appendTo($this);
        $this
            .addClass("linked")
            .prepend($a);
    })
});
Robin Schambach
  • 19,713
  • 1
  • 19
  • 44