latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Support for both local and AmazonS3 Downloads

Home Forums Community Forum Support for both local and AmazonS3 Downloads

This topic contains 8 replies, has 3 voices. Last updated by  Cristián Lávaque 3 years, 6 months ago.

Topic Author Topic
Posted: Wednesday Jun 26th, 2013 at 10:09 am #52611
Janet
Username: plrsifu

Hi

Currently I have thousands of files which are downloaded through the following type of link from the dls folder:

url=”?s2member_file_download=DownloadFile.zip”

My problem is that I now need to move some of the bigger files over to Amazon S3 but I cannot find anyway for S2Member to support both types of downloads.

Is there any S2 Hacks that will allow me to support both download types?

Thanks.

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Thursday Jun 27th, 2013 at 3:37 am #52656

You could try the [hilite mono]storage[/hilite] attribute for the shortcode, or [hilite mono]s2member-file-storage[/hilite] variable for the URLs.

See:
[hilite path]Dashboard -› s2Member® -› Download Options -› Shortcode Attributes -> storage[/hilite]
[hilite path]Dashboard -› s2Member® -› Download Options -› Advanced Mod-Rewrite Linkage[/hilite]

I hope that helps!

Posted: Thursday Jun 27th, 2013 at 5:16 pm #52697
Janet
Username: plrsifu

I’ve had a read of what you suggested and I see that I should be able to do this for the files I want downloaded from Amazon S3:

href=”?s2member_file_storage=s3&s2member_file_download=DownloadFile.zip”

But then this makes no sense because once I enter my Amazon S3 details into S2Member all files will be downloaded from Amazon S3 instead! So this is not going to work?

Is there any way I can configure my Amazon S3 details without forcing all files to be downloaded from Amazon S3?

Thanks

Posted: Friday Jun 28th, 2013 at 5:32 am #52714
Bruce
Username: Bruce
Staff Member

But then this makes no sense because once I enter my Amazon S3 details into S2Member all files will be downloaded from Amazon S3 instead! So this is not going to work?

The idea behind this value is gone over in the Shortcode Attributes section in the Download Options section. Here’s the excerpt:

storage=”” Defaults to [empty]. If storage=”local|s3|cf”, s2Member will serve the file from a specific source location, based on the value of this Shortcode Attribute. For example, if you’ve configured Amazon® S3 and/or CloudFront; but, there are a few files that you want to upload locally to the /s2member-files/ directory; you can force s2Member to serve a file from local storage by setting storage=”local” explicitly.

So, the idea is that if you want to serve a local file and you have Amazon s3/Cloudfront set up, you have to explicitly set the value to local. Then s2Member will search for the local file rather than try to serve a file from Amazon.

Does that work for you?

Posted: Friday Jun 28th, 2013 at 6:01 pm #52759
Janet
Username: plrsifu

Hi Bruce,

This does not help me at all…

Going back to my original question I stated that I currently have many thousands of local files which I use
the following type of link for them to be downloaded:

href=”?s2member_file_download=DownloadFile.zip”

And I just wanted to change a small number of these to be Amazon S3 downloads instead.

It would not be possible or practical to change every single one of these links to have the storage=”local”.

It’s the opposite that I require where I can add storage=”s3″ to some of the links instead.

Thanks

Posted: Friday Jun 28th, 2013 at 9:44 pm #52769

I understand what you’re saying.

When you configure the Amazon integration in s2Member’s download protection, that becomes the default and “local” is the exception you use with the [hilite mono]s2member_file_storage[/hilite] variable.

I’ll ask Jason if there’s a way to have Amazon not be the default, so it’s the exception instead. I’ll let you know as soon as I hear back from him. :)

Posted: Sunday Jun 30th, 2013 at 2:06 am #52818

Here’s what Jason replied back when I asked about Amazon not being the default despite it being configured:

Yes, but it will require a hack file. Here’s how to accomplish this.

<?php
add_action('ws_plugin__s2member_before_file_download_access', 's2_file_storage_default');
function s2_file_storage_default() {
	if(isset($_GET['s2member_file_download']) && !isset($_GET['s2member_file_storage']))
		$_GET['s2member_file_storage'] = 'local'; // 'local', 's3' or 'cf'.
}

Create this dir/file with that code: /wp-content/mu-plugins/s2-hacks.php
See: Knowledge Base » Hacking s2Member® Via Hooks/Filters

I hope that helps. :)

Posted: Monday Jul 1st, 2013 at 12:18 pm #52840
Janet
Username: plrsifu

Thank you so much… that’s the best s2hack so far and has saved me so much work…

I’m sure this will help a lot of other s2Members who want to do the same thing!

Thanks

Posted: Monday Jul 1st, 2013 at 4:40 pm #52844

Great! Glad it helped you. :)

Viewing 8 replies - 1 through 8 (of 8 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.