• Resolved vdowsett

    (@vdowsett)


    For the website I’m working on only those who are logged in should be able to download items. If they are not logged in, I’d like to send them to a customer url to ask them to either log in or register.

    I’m trying to apply the filter to redirect users to the other url rather than the current download error page if they are not logged in. (just the login url for now, but a custom page later) I’m no expert, was hoping to get advice on the correct code to use in my functions file.

    $download_url = wp_login_url();
    $redirect = apply_filter( 'dlm_access_denied_redirect', true, $download_url );

    http://wordpress.org/plugins/download-monitor/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Use this in your functions.pho file:

    /** Downloads Monitor redirection to login page for non-logged in members trying to download content */
    
    function redirection() {
        $redirected_url = $_SERVER['HTTP_REFERER'];
        $download_url = $_SERVER['REQUEST_URI'];
        $download_redirect = urlencode("{$redirected_url}?redirect-to={$download_url}");
    
        return "YOUR_URL_HERE";
    
    }
    
    // filter calls
    
    add_filter(dlm_access_denied_redirect,'redirection');
    Thread Starter vdowsett

    (@vdowsett)

    Hi, that did the trick, thank you so much for your assistance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirection filter if not 'Members'’ is closed to new replies.