PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Buy Now download fails

s2Member Plugin. A Membership plugin for WordPress®.

Buy Now download fails

Postby adherent » March 14th, 2011, 7:33 pm

Thank you for the great plugin. Each time I install a new functionality I sort out my failures until I get the desired result. I set up my first Buy Now button. When visitors not logged-in are shown the Member Option page they are given a choice to buy an ebook at retail price.

When the Buy Now button is clicked, the visitor is sent to paypal, completes the transaction, an email with a link to the download page is sent, and the customer is redirected to the download page right after the transaction. So far so good all works as desired.

Problem is, when the download button is clicked, instead of getting the download the customer is redirected to the Member Options page.

When I log-in as a free member I can access the download page and get the product but that defeats the option of buying without having to sign up.

Any ideas what can be done to get the download to work without signing up?

I'm using WP 3.1 and s2Member 3.5.2 in a multi-site environment.

Brian
User avatar
adherent
Registered User
Registered User
 
Posts: 6
Joined: March 14, 2011
Location: Vancouver Island, B.C.

Re: Buy Now download fails

Postby Cristián Lávaque » March 14th, 2011, 8:25 pm

You could have the file not be protected from download by s2Member, just host it normally and give the download link through the protected page only.

If you have an Amazon S3 account, you could try a plugin like Amazon S3 Expiring URL Generator to make it harder for the person to hotlink to the file, or share the file's URL. Although, if someone's to share a file, he can share the file itself.

Does this help you?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Buy Now download fails

Postby adherent » March 15th, 2011, 11:06 am

Thanks for your response Christian. The pages I sell access to are member download pages. The download pages contain multi-part video courses with ebooks and use s2member to manage access and specifically protect those files from hotlinking.

One option I thought of is to use a store plugin to manage retail sales but that would complicate and duplicate a lot of work.

The s2Member buy now button appears to present a more functional alternative except the download requires a customer to log-in. Although the site is set-up for level#0 free subscriber access, subscription would defeat the option of buying without having to sign up.

Before I accept the download protection limitation, (and limits to my fuzzy logic) I'd appreciate any ideas about what can be done to keep page and file protection the way they are and offer retail customers the option to buy access to protected downloads without signing up.
User avatar
adherent
Registered User
Registered User
 
Posts: 6
Joined: March 14, 2011
Location: Vancouver Island, B.C.

Re: Buy Now download fails

Postby Jason Caldwell » March 15th, 2011, 8:18 pm

Thanks for bringing this to my attention Cristián.
What you'll want to do is use s2Member's Advanced Download Restrictions. Which is to say, you'll want to use a Download Key on the end of your download links. You'll find further details on this in your Dashboard under: s2Member -> Download Options -> Advanced Download Restrictions.
This is recommended when your Customers are NOT logged-in.
By default, s2Member uses your Basic Download Restrictions. However, you can force s2Member to allow file downloads, using an extra query string parameter ( s2member_file_download_key ). A file download `Key` is passed through this parameter, and it tells s2Member to allow the download of a particular file, regardless of Membership Level; and WITHOUT a Customer login being required.

When s2member_file_download_key = a valid Key, it works independently from Member Level Access. That is, a visitor does NOT have to be logged in to receive access; they just need a valid Key. Using this advanced technique, you could extend s2Member's file protection routines, or even combine them with Specific Post/Page Access, and more. The possibilities are limitless really.

Code: Select all
http://localhost/wordpress/?s2member_file_download=example-file.zip&s2member_file_download_key=<?php echo s2member_file_download_key("example-file.zip"); ?>
* Note. In order for this to work, you will also need to have a PHP Execution plugin installed so the s2Member Download Key can be generated from within a Post or Page. Please see: http://wordpress.org/extend/plugins/php ... on-plugin/
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Buy Now download fails

Postby adherent » March 16th, 2011, 11:15 am

Thank you Jason, here is my experience so far..

I upgraded s2Member plugin yesterday to v 3.5.4

I applied the advanced download restriction but get - 503 ( Invalid Key ): Sorry, your access to this file has expired. Please contact Support for assistance.

I am developing the site on a mac using firefox so payment and download cookies are set in my firefox browser

Behavior noted so far:

When logged in as admin in Firefox a key is generated for the advanced download restriction but when clicked returns a 503 ( Invalid Key ) error. Other links on the page appear to work as specified. When I access the download page as a customer without logging in I get the same 503 message.

For Opera and Chrome when I logged in as admin different keys are generated for the advanced download restriction but return the 503 ( Invalid Key ) error when clicked. Other links on the page appear to work as specified.

Oddest behavior occurs in Safari when logged in as admin and I try to access the download page it redirects to the member option page. Other pages appear to work to specification.

Although the advanced download restriction code appears to be generating different access keys I am not getting the desired result.

Any ideas on what can be done next are sincerely appreciated.
User avatar
adherent
Registered User
Registered User
 
Posts: 6
Joined: March 14, 2011
Location: Vancouver Island, B.C.

Re: Buy Now download fails

Postby Jason Caldwell » March 18th, 2011, 7:04 pm

Maybe it will help to explain what a Download Key actually is.
The function `s2member_file_download_key()`, is part of the s2Member API. It produces a time-sensitive File Download Key that is unique to each and every visitor. Each Key it produces ( at the time it is produced ), will be valid for the current day, and only for a specific IP address and User-Agent string; as detected by s2Member. This makes it possible for you to create links on your site, which provide access to protected file downloads; and without having to worry about one visitor sharing their link with another. So let's take a quick look at what s2member_file_download_key() actually produces.

This recommended ( secure ) method of creating a Download Key:
Code: Select all
<?php echo s2member_file_download_key ("example-file.zip"); ?>
 = A Download Key ( i.e. a site-specific hash ) of:
s2member_xencrypt(date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file)


An undocumented feature also exists for this API function. ( note the second function argument )
Code: Select all
<?php echo s2member_file_download_key ("example-file.zip", "universal"); ?> 
 = A Universal Download Key that provides open access to everyone and anyone;
regardless of time, date, browser, or IP address. In other words, this Key variation is NOT secure.


When logged in as admin in Firefox a key is generated for the advanced download restriction but when clicked returns a 503 ( Invalid Key ) error. Other links on the page appear to work as specified. When I access the download page as a customer without logging in I get the same 503 message.
Hmm. Can you please post the full code snippet of your link and the call to the s2member_file_download_key() function please?
I'll be happy to have a look for you.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Buy Now download fails

Postby adherent » March 19th, 2011, 4:27 pm

The problem now appears resolved.

Four days ago I set a Buy Now button on a Member Options page. Everything worked as indicated above. I also set code [below] on the restricted member download page to test download of one of the products.
Code: Select all
<a href="http://www.mysite.com/?s2member_file_download=member-subdirectory/product-subdirectory/product-filename.zip&s2member_file_download_key=<?php echo s2member_file_download_key("product-filename"); ?>"><img height="52" width="150" src="http://www.mysite.com/image/image-filename.png" title="Product File Name" alt="" /></a>


Three things have changed since I last posted 4 days ago...
1. I updated s2Member to v 3.5.5
2. The cookie for the first test transaction expired
3. I removed the download key from my test link

After updating s2member and making another test purchase I noticed:
1. I could access the protected page without logging in and
2. The code [above] I used to test the download still generated the 503 error.
3. Other products on the restricted page could be downloaded as desired

So, I removed the download key and returned the test download link to its original setting similar to the other products on the page.

The page is now protected by membership and members can download. When access to the protected download page is purchased, a time limited secure access is emailed to customer, the customer gets immediate access to download page without logging in and customer can return to the download page within the time limit and without logging in to download. Now everything works as expected.

As for Safari users, it appears that unlike other browsers, cookies need to be manually removed in order to notice changes to updated code.

Thank you Jason and crew for code that works and support that helps us to get it to work.
User avatar
adherent
Registered User
Registered User
 
Posts: 6
Joined: March 14, 2011
Location: Vancouver Island, B.C.

Re: Buy Now download fails

Postby Jason Caldwell » March 21st, 2011, 8:14 pm

Thanks for reporting back on this topic.
~ Much appreciated!
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 0 guests

cron