Change Date Added for Files

Permalink
I'm migrating an existing wordpress site to C5. There are a couple of hundred pdf files that need to be ordered in date order (press releases etc.) Some of these files are 3-4 years old but of course C5 sees them as just uploaded when I add them to the file manager so they lose their chronological order.

The date added field on the File Properties dialog is uneditable - as it probably should be. I can edit the database directly, or create an extra file attribute (date published) and order by that I guess, but I just wanted to check that I'm not overlooking something simple before I get going on this task.

Anyone had a similar problem?

 
Mainio replied on at Permalink Reply
Mainio
I'd say it would be better to create a new attribute as you suggested "date published". Then you can sort by that.

If you want "out-of-the-box" sorting, you can add the files into a file set and then go to Files => Sets and create a new set for these files. Then, after you've added the files into that set, go back to the set view and click on the set. Now you can see "Files in Set" tab where you can re-order the set files.

However, I just said this because it would be the only way to do this with the UI only. In your case, you have the clear need of knowing when the file has been published, so I'd say the right way to go is to create the published attribute and update that programmatically for each file.


Antti / Mainio
soupmedia replied on at Permalink Reply
Thanks Mainio, yeah I figured that was the best way - at least the most
"Concrete5" way.
I had hoped that I could easily change the "Date Added" field because it
would be slightly easier for my client for future uploads to not have to
set a custom attribute.

I think I'll alter the block so it sorts on "date published" if the
attribute exists else sort on date added.

Cheers,
Nathan
Mainio replied on at Permalink Reply
Mainio
You could also update the new attribute automatically with the "on_file_add" event.

http://www.concrete5.org/documentation/developers/system/events/...