Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18961

    deadhead1971
    Participant

    Hi

    I’m currently evaluating lots of download manager plugins and so far, yours is the nicest :-)

    Just one barrier for me –

    All my download attachments will be on private pages which only display the content if the user is logged in, and a member of the specific group (as defined by a custom user field on their profile).

    However, if I log in and copy the download link, then paste it into a new browser window where I am not logged in, it still serves me the file. So this means people could potentially share download links and I need to protect against that.

    How can I achieve this please?

    Many thanks
    Alan

    #19110

    deadhead1971
    Participant

    In case it’s useful to anyone else, I’ve bodged a fix for this.
    This will disable the plugin for any user who is not logged in, so if any logged in users try to share direct download links with non-logged in users, they will just get a white screen.

    Create a new file called disable-logged-out-plugin.php with this code, and then upload it to the mu-plugins in your wp-content folder:

    <?php
    add_filter( ‘option_active_plugins’, ‘disable_logged_out_plugin’ );
    function disable_logged_out_plugin( $plugins ) {
    require (ABSPATH . WPINC . ‘/pluggable.php’);
    if ( !is_user_logged_in() & !is_admin() ) {
    $key = array_search( ‘download-attachments/download-attachments.php’ , $plugins );
    if ( false !== $key ) {
    unset( $plugins[ $key ] );
    }
    }
    return $plugins;
    }

    #20389

    Luk
    Participant

    Hi from new user and WP inexpert!!!
    Where is “mu” folder where to upload your php file?
    Thanks

    #24863

    deadhead1971
    Participant

    If you use FTP to access your server, just navigate to the wp-content folder and create a new folder called mu-plugins if you don’t already have one there.

    #31118

    Perdu
    Participant

    Thank you for the feedback, it helped me

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.