Sander Vercampt

Forum Replies Created

Viewing 1 post (of 1 total)
in reply to: before_download #183926

Sander Vercampt
Participant

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!

Viewing 1 post (of 1 total)