Allow Admin to see a record of who downloaded an attachement

Started by gdavison, February 06, 2025, 01:41:50 PM

Previous topic - Next topic

gdavison

Searched the Mods section and tips and tricks and cant see an existing mod or a tip on how an Admin could achieve this.  Like many users of SMF I use SMF to run a club forum and often we attach key documents to posts for members to read such as a Safety Assessment for an activity and I am wondering if there would be a way for a feature to allow allow Admins to see a record of who downloaded the attachment .. Admittedly downloading said attachment and reading it are two completely unrelated things  :D

Can it even be done ?  If so can the feature also record date / time of the download ?

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Doug Heffernan

Quote from: gdavison on February 06, 2025, 01:41:50 PMCan it even be done ?  If so can the feature also record date / time of the download ?

Yes, that can be done. However it will require custom coding. I also agree with Lex that this is best done as a mod rather than a built in feature.

GL700Wing

@gdavison I use the Who Downloaded Attachment mod on my SMF 2.0 forums.

This image shows the default members list display:
You cannot view this attachment.

This image shows the expanded members list display (ie, when you click on the  '[Members List]' link).
You cannot view this attachment.

There seems to be an SMF 2.1 compatible version on GitHub (zip file attached) but I haven't tested it to know if it works.


I've customised the ./Sources/Mod-WhoDownloadedAttachment.php file as follows:

Find:
LIMIT 1000',Add before:
ORDER BY d.log_time ASCReason for change: To display list in date order (most recent at bottom of list - change ASC to DESC if you want the most recent at the top of the list).


Find:
$context['download_list']['xml'] = $download_list;Replace with:
$context['download_list']['xml'] = str_replace(' ', ' ', $download_list);Reason for change: Non-breaking spaces were causing issues for JS/Ajax on my SMF 2.0 forums.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

gdavison

thanks all for the responses (this community rocks) ... will take a serious look at that mod @GL700Wing TY

Advertisement: