Support » Plugin: File Away » Showing 2 file lists in 1 Sortable Data Table

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author thomstark

    (@thomstark)

    You have two options. Directory Tree navigation, or Recursiveness. If you turn on recursiveness, it will display all files in all subfolders as if they were all in one directory. If you turn on directory tree navigation, it will allow users to navigate different subdirectories.

    If recursion is on, it will iterate through the subdirectories ad inifinitum, so if you only want to show two directories, put those two directories, and those two directories alone, in an empty parent directory, then point your shortcode to that parent directory.

    Thanks Thom,

    But whjat if the two folders are in totally different locations ie:

    httpdocs/protected_files/
    httpdocs/not_protected/

    Cheers

    Plugin Author thomstark

    (@thomstark)

    Are there other directories in httpdocs besides those two? Because that’s what they call a parent directory.

    Yes lots, that was just a rough example. Ok, let me give a more accurate example.

    This is where the protected files with their sub folders live
    domain.com/wp-content/plugins/protected_dir/audio1/example1.aiff

    This is where the publicly downloadable files that are not protected live. All files and folders would have the same names as the ones liste above but with different file extension.
    domain.com/mp3_previews/audio1/example1.mp3

    So, the purpose is to protect the .aiff file and only let paid members download it but the .mp3 file is a preview and can be downloaded by all. If both files are shown in the Sortable Data table that would be awesome.

    Unless ofcourse you can figure a way to replace the .mp3 file link with a music player, now that would be the ultimate.

    Plugin Author thomstark

    (@thomstark)

    This is possible but it will take a hefty revision and I’m swamped at the moment. I’ll try to get to it as soon as I can.

    Can I throw some dollars at you to speed things along?

    Plugin Author thomstark

    (@thomstark)

    Well the issue is I’m being paid money to do other work right now, but when I can sneak away I will. In the meantime, if you’re comfortable using a little unorthodox hack, this might work for you until I can get to an update.

    There is a field on the File Away Options page under the basic Config tab, called “Exclude Directories.” With a little hack, we can temporarily use this for the opposite purpose, and apply it to recursive mode. (It currently only applies to Directory Tree mode.) So what we can do is use it as an “Include Only Directories” instead of its intended purpose, then make one little adjustment to one of my functions.

    If you’re comfortable editing php (make sure you have ftp access in case something goes wrong):

    Navigate to wp-content/plugins/file-away/includes/ and open up reference-functions.php

    The function we’ll be modifying is right at the top of the page, and it’s labelled //RECURSIVE DIRECTORY ITERATOR

    You’re going to replace this:

    foreach(glob($directory, GLOB_ONLYDIR | GLOB_NOSORT) as $folder):
    	$directories[] = $folder; ssfa_recursive("{$folder}/*", $directories);
    endforeach;

    with this:

    $direxes = SSFA_DIR_EXCLUSIONS ? preg_split ( '/(, |,)/', SSFA_DIR_EXCLUSIONS ) : false;
    foreach(glob($directory, GLOB_ONLYDIR | GLOB_NOSORT) as $folder):
    	$direxcluded = 0;
    	if($direxes):
    		foreach($direxes as $direx):
    			$check = strripos($folder, $direx);
    			if($check !== false) {$direxcluded = 1; break;}
    		endforeach;
    	endif;
    	if ($direxcluded || !$direxes):
    		$directories[] = $folder; ssfa_recursive("{$folder}/*", $directories);
    	endif;
    endforeach;

    I haven’t tested this but it should work for you as a temporary solution. Then just type the names of the two folders into the field on the Config Tab, and they will be the only two folders included in your recursive table.

    Thanks Thom but it didn’t seem to like that.

    I specified the mp3 preview folder in the ‘Exclude Directories’ field and then used this shortcode in my page

    ‘[fileaway type=”table” name=”list” sub=”bass_guitar_samples” images=”none” recursive=”ohglory”]

    It resulted in this error on the page.

    Warning: Invalid argument supplied for foreach() in /home3/toolance/public_html/domain.com/wp-content/plugins/file-away/includes/reference-functions.php on line 33

    Plugin Author thomstark

    (@thomstark)

    Did you try pointing it to the parent directory? You need to specify the two directories (mp3 preview and aiff full) in the Exclude Directories field, then point the shortcode to the httpdocs directory. See if that helps.

    I’m only able to specify one line of url in that Exclude Directories field. Is there a way to enter more than one?

    Plugin Author thomstark

    (@thomstark)

    comma-separated, not a url. just the names of the directories, like this:

    protected_files,not_protected

    that fixed the error but the list is just showing the aiff files with no sign of the MP3 files.

    Plugin Author thomstark

    (@thomstark)

    the directory names in the “exclude” field have to match exactly, case-sensitive. check that first. if it’s still not working, i’ll try and troubleshoot later, but I have to run at the moment.

    yep, checked all that a few times, still no joy. Thanks for trying though. I really appreciate the help.

    Cheers
    Gavin

    Plugin Author thomstark

    (@thomstark)

    The reason you got only one of the two dirs was an error on my part:

    {$direxcluded = 1; break;}

    should have been:

    {$direxcluded = 1; continue;}

    Anyway, I’m working on it right now.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Showing 2 file lists in 1 Sortable Data Table’ is closed to new replies.