before_download

in Download Manager Free

Viewing 4 posts - 1 through 4 (of 4 total)
Feb 20, 2023 at 1:13 pm
#183911
Participant
Sander Vercampt
OP

Hello,

Should the before_download action work in the free version?

https://www.wpdownloadmanager.com/doc/filter-reference/wpdm_before_download/

I can’t get it to work

Thanks!

Feb 20, 2023 at 2:40 pm
#183914
Spectator
Humayon

Hi,

Thank you for writing to us.

The before_download filter should work in the free version as well.

If it doesn’t work then can you please let us know what output you are trying to achieve?

Regards

Feb 20, 2023 at 5:21 pm
#183926
Participant
Sander Vercampt
OP

Hi,

I’m trying to add an extra check for rights.
Before someone is downloading the file (he clicks on the link), I want to check if he has all the rights needed to download the file.
So I was thinking to check that in the before_download, if not I want to redirect to another page.

I added the example code that was given in the docs in my functions.php, but the action is not triggered…

add_filter('before_download', 'wpdm_before_download_package', 10, 1);

function wpdm_before_download_package($package)
{
//todo: Modify any package settings. This changes made here are only for current requested download if you do not update the option.
  var_dump('Test before download');exit();
  return $package;
}

If I’m correct I should get ‘Test before download’ if I try to download the file??

Thanks!

Feb 21, 2023 at 8:51 am
#183962
Viewing 4 posts - 1 through 4 (of 4 total)

The topic "before_download" is closed to new replies.