Description
Allows you to filter whether the user can download or not.
Parameters
$args
(array)(required) An array of arguments passed from handle_download().
key => The file’s key (a post meta value used to locate the file)
user_verified => boolean, If the user is verified to download the file, default: false
file_info => array (
post_id => The post ID
results => raw $results array from SQL select
post => The post object for this post ID
meta => All post meta for this post ID
raw_file => The basename() of the file path (returned from get_attached_file())
path => Path to the file’s download location
)
Usage
// Example validates user by membership product
add_filter( 'wpmem_dp_verify', 'my_download_verification' );
function my_download_verification( $args ) {
$membership = 'my_membership_product'; // The meta key of the membership.
if ( wpmem_user_has_access( $membership ) ) {
$args['user_verified'] = true;
}
return $args;
}Changelog
- Introduced in 1.0.0
Source
wpmem_block is located in includes/class-wp-members-download-protect.php