Forum Replies Created

Viewing 15 replies - 1 through 15 (of 77 total)
  • Plugin Author Adam Bissonnette

    (@mmanifesto)

    A really simple way to do this is with the “li” format instead of a table like this:

    [MMFileList format=’li’ types=’pdf’ dateformat=’d-m-Y’]{name} ({date})[/MMFileList]

    If you want to accomplish the same with a table you’ll need to use the custom format.

    You should be able to do it like this:

    <table>
    <tr>
    <th>Filename</th>
    <th>Date</th>
    </tr>
    [MMFileList format='custom' types='pdf' dateformat='d-m-Y']
    <tr><td><a href='{url}'>{name}</a></td><td>{date}</td></tr>
    [/MMFileList]
    </table>

    Here is an example of it on my site:
    https://www.mediamanifesto.com/uncategorized/test-shortcode/

    Let me know if this helps – cheers!

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    I think you could maybe use the custom template functionality to put a list in your list. So you could list the midi files in one and then the template could have a list filtered specifically to your list of PDFs and regex matches to the related file – filenames would have to be similar which it sounds like they are.

    This is entirely hypothetical though – I’m not sure if it would work and it would probably take more resources to render – you’ll want good caching on your site ??

    I’m pretty sure this shortcode support sub-shortcodes so the solution could look something like this:

    [MMFileList folder="/cats/" removeextension="1" types="midi" format="li"]{name}.midi ({size})<br />
    [MMFileList folder="/cats/pdfs/" types="pdf" format="li"regexfilter="/{name}/" regexfilterinclusive="1"]{name} ({size})[/MMFileList][/MMFileList]

    This could create an infinite loop if done wrong so you might have to disable the plugin to undo any mistakes.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    You should be able to use a regexfilter like this:
    [MMFileList ... regexfilter=”/index.php/” /]

    Lemme know if it works.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    I’m happy to help and if the plugin is providing value then that’s payment enough :)!

    Can you share the original filename with me? It looks like you’re using “pretty filename” which should run the following regex: /-|_| |\.[a-zA-Z0-9]*$/

    I think the problem is that that first dash needs to be escaped. I’ll have to troubleshoot later here though and maybe push a new update to the plugin to fix it. I’ll keep you posted!

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Strange! What does your shortcode look like? Are you using regex to rewrite some stuff? I thought it would be a font issue but there is definitely something wonky here.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Sorry for missing this. I’d need to see this in action – I don’t think the regexfilter should be fighting with the format and types parameters. Are you still trying to get this working?

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    You could write a wrapper shortcode for it for dynamic folders. Something like this:

    <?php
    function ListUserFilesFunc($atts, $content="")
    {
        $output = "User is not logged in";
        $current_user = wp_get_current_user();
        if ( $current_user->exists() ) {
          $folder = '/wp-content/uploads/folders/' . $current_user->name;
          $shortcode_template = '[MMFileList folder="%s" format="table" /]';
    
          $output = do_shortcode(sprintf($shortcode_template, $folder));
        }
    
        return $output;
    }
    
    add_shortcode('ListUserFiles', 'ListUserFilesFunc');
    

    That could go into your functions.php file if you have a child theme – alternatively it’d be easy to put the above code into a mini plugin. Lemme know if this helps.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Hey – it checks the directory on every page load. There is no built in caching. A caching tool could cache it but this one won’t offhand.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Sorry for missing your note here I was off on holidays.

    Looking at the path in that error statement:
    /home4/jeepthin/public_html/wp-content/uploads/2022/04/../../../../../wp-content/ojt-files/newsletters it look like there are five ../ sections I believe are coming from the shortcode. This will move it up past the folders 04/, 2022/, uploads/, wp-content/ and also public_html/ – I think this is problem because it’s looking for your content in jeepthin/wp-content/ojt-files/newsletters/.

    If you change it to use just four “../../../../wp-content/ojt-files/newsletters” then that should work. Alternatively you could use just three and remove the wp-content from your shortcode too “../../../ojt-files/newsletters” because wp-content is already in your path you don’t need to go past it then back up.

    Let me know if this works. I can do a quick hangout call or screenshare session if you want to try figuring this out together too.

    Cheers,
    Adam

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Looks like your upload settings were maybe changed to put your media files into year/month folders. Try using the shortcodes like this [MMFileList folder=”/../../../wp-content/ojt-files/newsletters” orderby=”name” order=”desc” /]

    You might need more or fewer /../’s in there. You could also swap out the wp-content for one fewer /../

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Heya I’ve added a new version with this feature just for you. You can use the regexfilter parameter to exclude any filenames with “xyz” and then if you use the regexfilterinclusive parameter you can flip the behaviour so it only shows files that match.

    Here are some examples on my test site:
    https://mediamanifesto.com/skunkworks/file-list-tests/

    The readme was also updated with some examples but for your example specifically where you want to list all files contains “xyz” you can use the shortcode with parameters as follows:
    [MMFileList regexfilter=”/abc/” regexfilterinclusive=”1″ /]

    You can play around with regex formatting here to get a pattern that works for your use case:
    https://regex101.com/

    Or if you want to keep the discussion in the forums feel free to add another message and I will try to help as soon as I can ??

    Cheers and good luck!

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Hi there! It still works. I haven’t published an update in two years because it hasn’t needed one. The key with being a “simple” plugin is that it doesn’t embed scripts or mess with your admin interfaces. It’s just a shortcode and some helper functions so it should be safe to use. I’ll try updating here and hopefully that clears this issue up for people. Thanks for using the plugin and good luck with the site.

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    I think by default it’s trying to grab stuff out of your default media folder. If you go to settings -> media and then deselect “Organize my uploads into month- and year-based folders” you should be good.

    Can you share a copy of the shortcode you’re using just in case?

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Sorry for the late reply. You can definitely add a “download” button using the custom template functionality. If you shoot me a link to the website I can walk you through the process!

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Very strange – can you share a link to the site? If it finds the files it should be able to open those links directly – my only guess is that that subfolder maybe has strange .htaccess permissions or something.

Viewing 15 replies - 1 through 15 (of 77 total)