Attachments Added by Specific User

Shannon Dunn asked on May 4, 2020 22:02

A content author on our site was adding images as attachments instead of using MediaLibrary to insert the images. We want to find out where this author has done all this work since they cannot recall how many times and where they have done this. Looking at the attachment tables in the CMS, I cannot figure out a way to tie users to attachments for documents. Has anyone else come up with a good way to determine all the attachments added to documents by a specific user?

Correct Answer

Shannon Dunn answered on May 4, 2020 22:30

I figured it out. Pasting it here for those who may every need it:

SELECT Att.AttachmentName, Att.AttachmentExtension, Doc.DocumentName, Doc.DocumentNamePath FROM CMS_Attachment AS Att INNER JOIN CMS_Document AS Doc ON Att.AttachmentDocumentID = Doc.DocumentID WHERE Doc.DocumentModifiedByUserID = 'ENTER USER ID HERE'

0 votesVote for this answer Unmark Correct answer

Recent Answers


Peter Mogilnitski answered on May 5, 2020 21:52 (last edited on May 5, 2020 21:57)

This gives you the last date when the document that has an attachment was modified. It means I can change a document name but the attachment will be intact. You are getting document last modified date. Sorry this is not the correct answer.

Attachment versioning is more complex and depends how workflows are set up. Do you have versioning enabled in your system? There is a table called CMS_AttachmentHistory if you modified your attachment you must see the new record there (it doesnt tell who did though). There is a second table called CMS_VersionHistory this where you get a user who did modification. If versioning is enabled you can always "roleback" to previous version of your attachment. You must have Version tab in you document properties there you can see all document changes.

The other way is probably check the "staging" tables if you have the staging enabled, but not sure if you can get the user from there.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.