HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Possible to sort attachments by name?

This discussion is related to the fileupload addon.

Is it possible to sort attachments by name?

This would solve a problem for me :-)

Thanks for any help!

Comments

  • peregrineperegrine MVP
    edited December 2013

    yes, you could probably sort it via jquery or js as one solution, if you wanted to research it and write yourself a mod.

    although probably faster to sort via php upon discussion display.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I don't think I've got the skills to mod the plugin myself.

    I was hoping there might be a "sort" option somewhere in the plugin that I'm missing, but I don't see anything obvious.

  • peregrineperegrine MVP
    edited December 2013

    you could change the FileUpload/views/link_files.php ands sort there as well.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited December 2013

    .

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited December 2013

    deleted.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited December 2013

    @nathanreed

    replace FileUpload/views/link_files.php with the unzipped version of attachment below.

    if it works for you awesome, let me know.

    here is a mod for vanilla 2.0.18.10 of the plugin 1.5.2 downloadable

    if not .. oh well.

    and click awesome, do not accept this as best answer - otherwise this zip file will disappear.
    to be forewarned is to be forearmed.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited December 2013

    my final answer. :)

    modify  FileUpload/views/link_files.php  change line 5
    
    from
    
     foreach ($this->Data('CommentMediaList') as $Media) {
    
    
    
    
    to the following -  insert the following lines.... with line 5 comented as below.
    
    
       $newarray = array();
             foreach ($this->Data('CommentMediaList') as $Media) {
                   $name     =      htmlspecialchars($Media->Name);
                   $newarray[$name] = $Media;
                   }
    
               ksort($newarray);  // change attachment order to alpha sort.
               foreach ($newarray as $Media) {  
               // foreach ($this->Data('CommentMediaList') as $Media) {
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
Sign In or Register to comment.