Open PDF instead of downloading it

Hello

Hi Kat.

Did you try adding it to the inline extensions setting? WP Admin > s2Member > Download Options > Inline File Extensions

Let me know if that helped. :slight_smile:

Excellent! - the pdf opens in a new tab now.
Thank you Claveque

btw - do you know how to disable the “confirm download” message that pops up when I click the link to open the PDF?

1 Like

Not sure… I think that’s a browser thing.

Hi again Cristián
No, it must be a S2 Member message, because this is what it says…

Confirm File Download
You’ve downloaded 0 protected files in the last 365 days
You’re entitled to UNLIMITED downloads though,( so no worries).

in both chrome and microsoft edge

Oh, that one. Sorry, I thought you meant another thing.

For that, see: WP Admin > s2Member > Download Options > Shortcode Attributes > skip_confirmation

:slight_smile:

Thanks again Cristián,
I see the shortcode you are referring to - where would I go to add/edit that?

In the shortcode… You paste the shortcode in the page where you want to have the file URL/link, and add that attribute.

If you use the URL instead of the shortcode, you can pass it in the querystring, e.g. https://www.site.com?s2member_file_download=example.pdf&skip_confirmation=true

See also: https://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_s2member_file_download_url()

:slight_smile:

Hi Cristián

Really sorry to bother you again, but with regard to confirmation popup…
Do I just paste this code into the general text area in the page content area to prevent the confirmation message from showing when we click on a link to the file eg: https://www.site.com/?s2member_file_download=example.pdf
I can’t seem to get the shortcode to work?
[s2File skip_confirmation=“true”]

I thought it would be better to have a short code in the page rather than having to edit every URL, assuming that’s how it works.
Thanks again

1 Like

Yeah - switching of the confirmation box via options globally would be great - especially as I don’t see how you could enter the skip_confirmation=true if you link directly instead of using shortcode.

https://domain.org/?s2member_file_download=abc
will not work to add something without resorting to php (so not possible to use editor in html view).

Right now I only see how it works with a shortcode without php:
[s2File download="file.zip" skip_confirmation="true" /]

I would actually like to switch that off too - but I have like 10.000 links on my website in the format of:

<li><a href="https://domain.org/?s2member_file_download=odbl/mtbitaly_gmapsupp.7z">Openmtbmap - Italy</a> <span style="color: #808080;"><a style="color: #808080;" href="https://domain.org/?s2member_file_download=odbl/md5_hashes/mtbitaly_gmapsupp.7z.txt">(MD5)</a></span></li>

hence I see no easy way to add php stuff - because using an automated search/replace I am pretty sure will break other links too.

If your host has wp cli installed and you have ssh access you can try this. It even has a dry-run command so you can see what it will change before you actually do it.

https://developer.wordpress.org/cli/commands/search-replace/

No I cannot, because there is no regex that would not also destroy other shortcodes/links.

The easiest way to add this to my download links would be using notepad++ for all links on those sites - and then repair all shortcodes which got destroyed. Still quite a lot of work due to all the s2if and language tags on those pages.

I’ve used better search/replace quite a lot - it’s often easier than using direct sql on your database (or using sql commands in phpMyAdmin). I do think it’s better to not resort to [] shortcodes for such an amount of links as I’m pretty sure [] shortcodes cause a lot more PHP calls. That’s also why a global on/off for the download confimation would be nice. Then the shortcode could be used for individual overrides.