array_intersect(): Expected parameter 2 to be an array, string given in …

Viewing 7 posts - 1 through 7 (of 7 total)
#126293

Eur AG
Participant

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.
#126329

Nayeem Riddhi
Moderator

Hello,

It might be a conflict with other plugins or may have conflicts with your theme scripts. please try enabling/disabling your other plugins, if possible, Please, give your temporary wp-admin login details in a private reply for checking.

Thanks.

#126495

Eur AG
Participant
This reply has been marked as private.
#126595

Eur AG
Participant

Hello Nahem

Did you receive the access data I had sent via PM? Were you able to identify any cause of the errors?

Best

#126639

Nayeem Riddhi
Moderator

Please check, this package/file is working fine with the uploaded file, http://s2a.eura-partner.de/download/wpdm-test/, when I am trying to update the other package/file, the file size gets 0.00, and then I have checked that, wp-content/uploads/download-manager-files there the files are somehow missing. please check.

Thanks.

#126857

Eur AG
Participant

Hi Nayheem

thank you for your reply. I see that most of our files are not in the uploads/download-manager-files folder. We probably did something wrong with the upload process. Can I just move them from the uploads/2020/04 to the download-manager-files folder via FTP or do I need to go another way so that the system recognizes it?

thanks a lot
Uwe

#126894

Nayeem Riddhi
Moderator

You can updated your packages/files again.

Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘array_intersect(): Expected parameter 2 to be an array, string given in …’ is closed to new replies.