Download only for logged in Users
-
I’m trying to adapt the shortcode download_link with the following code:
add_filter('download_link','wpdm_download_link',10,1); // $package is an array containing current package info function wpdm_download_link($package){ // Do your thing with $package if ( ! is_user_logged_in() ) { // Test return "Not Logged In"; } //return $package['download_link']; return $package; }
Source: https://www.wpdownloadmanager.com/doc/filter-reference/download_link/
The aim is that if the user is not logged in, the link to log in is output instead of the actual link to the file. Unfortunately, a return false doesn’t seem to have any effect either. Anyone a tip?
For the sake of completeness, the
is_user_logged_in
function comes from the “Ultimate Member” plugin, which we also use.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Download only for logged in Users’ is closed to new replies.