Hi
I’m using the free version of Download Manager plus WP Pro Membership. All plugins up-to-date.
I have a couple of pdfs that are restricted and can only be used by one user (as well as by admin) who has to be logged in.
It worked fine for a couple of time but now I get error messages as soon as I try do download (see below) … what am I doing wrong? Thanks a lot!
Warning: array_intersect(): Expected parameter 2 to be an array, string given in /homepages/ … /wp-content/plugins/download-manager/libs/class.MediaAccessControl.php on line 80
Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/ … /wp-content/plugins/download-manager/libs/class.MediaAccessControl.php on line 81
When logged in as admin I get an additional error message:
Headers already sent in /homepages/ … /wp-content/plugins/download-manager/libs/class.MediaAccessControl.php on line 80
line 80 and 81 both in this file are:
$user_allowed = array_intersect($user_roles, $access);
$user_allowed = count($user_allowed);
with in the function:
function protectMediaLibrary(){
if(isset($_REQUEST[‘wpdmmediaid’])){
global $wpdb, $current_user;
$media = get_post($_REQUEST[‘wpdmmediaid’]);
$media_meta = wp_get_attachment_metadata($_REQUEST[‘wpdmmediaid’]);
//wpdmdd($media_meta);
//wpdmdd($media);
$media->path = str_replace(home_url(‘/’), ABSPATH.’/’, $media->guid);
$media->filesize = wpdm_file_size($media->path);
$access = get_post_meta($media->ID, ‘__wpdm_media_access’, true);
$password = get_post_meta($media->ID, ‘__wpdm_media_pass’, true);
$private = get_post_meta($media->ID, ‘__wpdm_private’, true);
if(current_user_can(‘manage_options’)) $private = false;
$user_roles = is_user_logged_in() ? $current_user->roles + array(‘public’) : array();
$user_roles[] = ‘public’;
$user_allowed = array_intersect($user_roles, $access);
$user_allowed = count($user_allowed);
if( $private && ( $password || !$user_allowed ) ) {
$picon = wp_get_attachment_image($media->ID, ‘thumbnail’, true);
$keyvalid = true;
$__hash = Crypt::encrypt($media->ID);
$download_url = “”;
include wpdm_tpl_path(“media-download.php”);
die();
}
$upload_dir = wp_upload_dir();
$file_path = $upload_dir[‘basedir’].’/’.$_REQUEST[‘wpdmmedia’];
$file_path = apply_filters(“wpdm_media_download”, $file_path, $media->ID);
FileSystem::downloadFile($file_path, basename($file_path), 10240, 0, array(‘play’ ► 1));
die();
}
Thanks in advance!
-
This topic was modified 5 years ago by
Eur AG.