Quick workaround to sort attachments of a Task by date


Just like the comments section. Ascending or descending by date of attachment. Latest setting saved automatically per user.

Maybe there is a plugin arround which is not in the official repo?

Cheers, Fx

I’ve seen such request for plugin several times at github fucntion request or forum, I remember someone pointed out it need to modify base code of kanboard to achieve, so after so many years such a basic request are not completed.

That would be a great pity. Can someone confirm this? Or has other information or hints?

Cheers, Fx

I’m not certain, but from what I’ve seen, it really would take changes to the Kanboard core. But i’ts considered of minor importance to implement. “Quick workaround”™ is something else.

I’am a friend of that “Quick workaround”™ :grinning:

You mean changes to the core code for my own installation. Or do you have other work arounds on your mind / ideas?

Cheers, Fx

I think it could be done by a plugin, if you find someone who does it. But above you stated:

And that’s core stuff. AFAIK, you cannot override everything.

definately could be done in a plugin, but yeah, would need an override, I don’t see any hooks before the iteration of the files, and no hooks in the model.

for a quick fix, just edit the core, with a sort of the $files array.

// Get a list of dates
foreach ($files as $key => $row) {
    $dates[$key] = $row['date'];

// Sort the array by date column in ascending order
array_multisort($dates, SORT_ASC, $files);

do this before the iteration, on line 9 of the files.php template.

i didn’t test, so don’t hold me to it. Plausible, the array is not exactly built the way i think it is…

No fear, i will not hold you :grinning:

Thanks to both of you. I will have a closer look as soon as i have a time slot.

Cheers, Fx