News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Attachment administration

Started by sessus, April 16, 2008, 09:58:37 AM

Previous topic - Next topic

sessus

Just some general questions:

1. Is it possible to allow Admins and Moderators a larger upload quota and a larger upload size for attachment compared with 'regular' users?

2. Is it possible to sort attachments, once attached to the thread, alphabetically rather than by date added?

Thanks in advance.

Oldiesmann

#1
Neither option is currently possible in SMF, although the attachment feature should be as simple as tweaking the query to sort them by the name instead of just pulling them in the order they were uploaded.

Try this...

Sources/Display.php

Find
Code (Line 867) Select
AND a.approved = {int:is_approved}'),

Replace
AND a.approved = {int:is_approved}
ORDER BY a.filename ASC'),
Michael Eshom
Christian Metal Fans

sessus

#2
More precise attachment administration is a pity, but thanks a lot for the sorting issue, Oldiesmann.

That alteration to the Display.php didn't do anything unfortunately.

Oldiesmann

Just took another look at the code and that last line of code is only output if post moderation is enabled or you're allowed to approve posts...

Try this instead:


Find
Code (Line 867) Select
               AND a.approved = {int:is_approved}'),

Replace
               AND a.approved = {int:is_approved}' .
            '
            ORDER BY a.filename ASC'),
Michael Eshom
Christian Metal Fans

sessus

Thank you for your efforts Oldiesmann, unfortunately your last code snippets didnt't work either. Could it be because the filenames are not continuous, bur rather have 'spaces' in them?

Oldiesmann

I'll have to look into it more soon. SMF must be forcing them to be displayed in order based on the attachment ID somewhere.
Michael Eshom
Christian Metal Fans

karlbenson

Indeed they are sorted by attachment ID
         // This is better than sorting it with the query...
         ksort($temp);

Oldiesmann

In that case...

Sources/Display.php

Find
Code (Line 877) Select
$temp[$row['id_attach']] = $row;

Replace
$temp[$row['filename']] = $row;

That should do it :)
Michael Eshom
Christian Metal Fans

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Advertisement: