• Resolved Julian

    (@jolution)


    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.

    • This topic was modified 3 years ago by Julian.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Sohrat

    (@sohrat)

    You need some customization for this. Please contact our customization team.

    Thanks

    Plugin Contributor Shafaet Alam

    (@shafayat-alam)

    Hi,
    You actually do need to edit code for that, you can set the login link or any custom message there from wpdm settings:

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Download only for logged in Users’ is closed to new replies.