Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Cristián Lávaque

    (@clavaque)

    The file can be protected at a specific level putting it in subfolders. See: WP Admin > s2Member > Download Options > Custom Capability and Member Level Files

    E.g. /s2member-files/access-s2member-level1/

    The link itself can be displayed or not using a conditional. https://s2member.com/kb-article/s2if-simple-shortcode-conditionals/

    E.g. [s2If current_user_can(access_s2member_level1)]Link to level 1 file.[/s2If]

    I hope that helps. ??

    Thread Starter vipini

    (@vipini)

    thats not what i asked

    here:

    How to mask external download links to be only accessible by s2member logged-in users?

    Like the direct download link example: https://www.example.com/direct-download-link1

    We want to mask it like: https://www.ourwebsite.com/direct-download-link1

    and this above link should only be accessible by logged-in members.

    The outsider shouldnt be access to link if they paste into their browser if they dontt have s2member level

    How to do?

    Plugin Author Cristián Lávaque

    (@clavaque)

    I am sorry, I had not understood your question before.

    Domain masking is not something that s2Member was designed to do. You can google how to configure your domain/server to achieve it, though.

    For the user to be logged into the other site, you need him to login first, and he’ll need an account on your site for that. It’s not just a link to the site.

    WordPress domain names matter for the login session, even changing the www subdomain to none, would be a different session. This is a WordPress thing, not s2.

    If you get the user to be logged in on your WordPress site where s2Member is, and that user’s account has the access required for the files you protected with s2Member, then he’ll be able to download them.

    Thread Starter vipini

    (@vipini)

    $user = wp_get_current_user();
    if( $user->exists ) {
        add_filter( 'public_link_root', function() { return 'example.com'; } );
    }
    Whenever you have to output a link, instead of doing that check over and over, because it's already established that the user's logged in, if you wrote your system in the correct manner (and you can do additional checks), do:
    
    $link_to_output = apply_filters( 'public_link_root', 'ourwebsite.com' ) . '/resources/whateve

    how can i implement above code with s2member?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to mask external download links to be only accessible by s2member level?’ is closed to new replies.