List Custom Capability Protected Files
If you want to list all the files protected with a particular custom capability, here's a way to achieve it via PHP.
Create this directory and file:
/wp-content/mu-plugins/s2-list-ccap-files.php
See: http://codex.wordpress.org/Must_Use_Plugins
<?php
function s2_list_ccap_files($ccap) {
if ($ccap && is_string($ccap)) {
$dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'].'/access-s2member-ccap-'.$ccap;
if (is_dir($dir) && is_readable($dir))
foreach (scandir($dir) as $file)
if (strpos($file, '.') !== 0)
$files[] = $file;
}
return (!empty($files) && is_array($files)) ? implode('<br />', $files) : '';
}
Now install a PHP execution plugin to use this in a post/page.
<?php echo s2_list_ccap_files('video'); ?>
If you get PHP header errors, you most likely have something (e.g. space, tab, line breaks) outside the PHP block.