Skip to content

Instantly share code, notes, and snippets.

@LMNTL
Last active June 19, 2019 23:23
Show Gist options
  • Save LMNTL/667eeec8fbd7c68e3d7c5032003a7fa3 to your computer and use it in GitHub Desktop.
Save LMNTL/667eeec8fbd7c68e3d7c5032003a7fa3 to your computer and use it in GitHub Desktop.
Require PMPro membership for all Download Monitor downloads. Requires Paid Memberships Pro and Download Monitor to be installed and configured.
/*
Require PMPro membership for all Download Monitor downloads.
Requires Paid Memberships Pro and Download Monitor to be installed and configured
NOTE: this will work with or without the Download Monitor Integration Add On for PMPro.
*/
function my_pmpro_dlm_has_download_access( $continue ) {
/* you can change this line to restrict download to only specific levels
https://www.paidmembershipspro.com/documentation/content-controls/require-membership-function/ */
if ( function_exists( 'pmpro_hasMembershipLevel') && !pmpro_hasMembershipLevel() ) {
$continue = false;
}
return $continue;
}
add_filter( 'dlm_can_download', 'my_pmpro_dlm_has_download_access', 29, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment