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™

Forcing custom redirect after a successful purchase

s2Member Plugin. A Membership plugin for WordPress®.

Forcing custom redirect after a successful purchase

Postby solraco » July 15th, 2011, 9:57 am

I set up s2member pro on our site and everything seems to be working smooth. I just have one problem to fix...

The custom redirect after purchase is not working. It stays on the same page and give me this message.

Thank you. Your account has been approved.
— Please login.


Instead of redirecting to our thank you page.

Here is a link to the form. http://www.clearwateremc.com/workshop/conditionsmagic/membership-options-page/

This is the short code im using to pull the form.
Code: Select all
[s2Member-Pro-AuthNet-Form level="2" ccaps="" desc="$77.00 USD / One Time ( for lifetime access, non-recurring, no trial )" cc="USD" custom="www.clearwateremc.com" ta="0" tp="0" tt="D" ra="77.00" rp="1" rt="L" rr="BN" accept="visa,mastercard,amex,discover" coupon="" accept_coupons="0" default_country_code="US" captcha="0" success="http://www.clearwateremc.com/workshop/conditionsmagic/thank-you" /]


I've tried everything I could come up with but it just wont work for me... is there something I'm doing wrong here?

Thanks for your help.
User avatar
solraco
Registered User
Registered User
 
Posts: 4
Joined: July 15, 2011

Re: Forcing custom redirect after a successful purchase

Postby peterhuk » July 15th, 2011, 5:36 pm

Hi All,

I seem to be having the same problem as Solraco, having tried everything I finally
realised it was time to asked for help after experiencing a mini explosion in the
centre of my cerebral cortex :o .

Having said that Solraco according to the documentation you should only enter
the page / folder name only i.e success="/my-thank-you-page/".

Jason / Chris what events trigger the success redirect does
the plugin require jquery v1.6 as I am currently using v1.4.

The redirect worked perfectly on my home system but now I have
moved it to a hosted demo for more tests. Not sure if the problem
is related to the move to the hosted environment or the updated
version of S2Member / S2Member Pro.

Any ideas?

Kind Regards

Peter
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby peterhuk » July 16th, 2011, 3:46 am

Hi Jason / Chris,

Quick question, should the logs show any info on the redirect on success value?

Many thanks


Peter..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby solraco » July 16th, 2011, 9:38 am

Hey Peter,

I found a way to override this function. I don't know if this is the best way to do it but I needed to get it working today for a client and I decided to do it.

I'm using authorize.net for this so I found the file where the success message is coming from.

s2member-pro\includes\classes\gateways\authnet\authnet-checkout-in.inc.php

and changed the $global_response attributes on lines 241 440 691 to this:
Code: Select all
global_response = array ("response" => header( 'Location: https://www.clearwateremc.com/workshop/conditionsmagic/thank-you/' ));


And its working for me now... i know this is more of a hack but I had to get this up and working.

If anyone here knows how to fix this without having to edit the s2member code... let me know.

Thanks!
User avatar
solraco
Registered User
Registered User
 
Posts: 4
Joined: July 15, 2011

Re: Forcing custom redirect after a successful purchase

Postby peterhuk » July 16th, 2011, 12:02 pm

Well spotted Solraco,

I am using Paypal, so I will look for the equivalent. Then try and trace the fault.

The biggest problem I find with hacking is, as so as you update S2Member you
will be back at square one and have to fix the problem again (if you remember
what the fix was).

Will let you know when I find something.

Many thanks


Peter..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby Cristián Lávaque » July 16th, 2011, 4:17 pm

solraco wrote:This is the short code im using to pull the form.

[s2Member-Pro-AuthNet-Form level="2" ccaps="" desc="$77.00 USD / One Time ( for lifetime access, non-recurring, no trial )" cc="USD" custom="www.clearwateremc.com" ta="0" tp="0" tt="D" ra="77.00" rp="1" rt="L" rr="BN" accept="visa,mastercard,amex,discover" coupon="" accept_coupons="0" default_country_code="US" captcha="0" success="http://www.clearwateremc.com/workshop/conditionsmagic/thank-you" /]


Peter is correct about the success address format. Try this success="/workshop/conditionsmagic/thank-you". Here's the documentation for it WP Admin -> s2Member -> Auth.Net Pro-Forms -> Custom Return URLs On Success

You can add a special attribute to any Form Shortcode ( success="/my-thank-you-page/" ). This makes it possible to integrate Authorize.Net® Pro Forms in very creative ways; and even receive/verify Replacement Code variables, as needed. For example, ( success="/my-thank-you-page/?subscr_id=%%subscr_id%%" ).


I hope that works for 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: Forcing custom redirect after a successful purchase

Postby Cristián Lávaque » July 16th, 2011, 4:22 pm

peterhuk wrote:The redirect worked perfectly on my home system but now I have moved it to a hosted demo for more tests. Not sure if the problem is related to the move to the hosted environment or the updated
version of S2Member / S2Member Pro.


I don't know. Try updating s2Member/Pro in the server where it was working before and see if the success attribute works then: If not it'll be the update, if yes then it'd be the new host.

Quick question, should the logs show any info on the redirect on success value?


I don't know. Why don't you check the logs in the install where the redirection works? I haven't tried this myself.
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: Forcing custom redirect after a successful purchase

Postby peterhuk » July 16th, 2011, 7:19 pm

Hi Chris,

Many thanks for your feed back, remember when I said (above)
that I experienced a mini explosion in the centre of my cerebral
cortex? Well that was roundabout the time my home server
crashed and all data was lost and then I discovered that the redirect
failed to work on the new hosted server.

So I have nothing to compare notes with. Solraco provided a
very good lead. I have just added a print_r($post_vars); to a
point in paypal-checkout-in.inc.php (between line 66 and line 67)
and the success variable shows up in the returned vars array.

What I am going to check is the conditions for the success vars
to be executed. Once I have found this it should shed some like
on why it is not working.

Will update when I have found something.

Many thanks

Peter
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby peterhuk » July 16th, 2011, 8:19 pm

Code: Select all
c_ws_plugin__s2member_utils_urls::remote (site_url ("/?s2member_paypal_notify=1" . $ipn_q), $ipn, array ("timeout" => 20));


returning a 403 forbidden error. this is causing the

Code: Select all
substr ($ipn["s2member_paypal_proxy_return_url"], 0, 2) === substr ($post_vars["attr"]["success"], 0, 2)


compare to fail (sorry can't give line numbers at present as have inserted a number of check points which has altered the line numbers).

currently investigating

Code: Select all
c_ws_plugin__s2member_utils_urls::remote
to see what it is doing which is causing
the 403 forbidden error.

Peter..
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby peterhuk » July 17th, 2011, 7:58 am

Hi Jason, Chris,

Problem RESOLVED!!

This was a nice one, the 403 forbidden was a red hiring brought on by my
htaccess (set to only allow my ip address on my demo server but did not include
the server ip address so it was effectively blocking itself whilst doing a url check).

Line 278 in file s2member-pro\includes\classes\gateways\paypal\paypal-checkout-in.inc.php

Had the follow compare check

Code: Select all
substr ($ipn["s2member_paypal_proxy_return_url"], 0, 2) === substr ($post_vars["attr"]["success"], 0, 2)


This check continued to fail even though the variables appeared the same . this is probably due to the
More precise ‘===’ part of the compare.

In order to filter out any noise I simply added a trim around the two variables making it:

Code: Select all
substr (trim($ipn["s2member_paypal_proxy_return_url"]), 0, 2) === substr (trim($post_vars["attr"]["success"]), 0, 2)


and just to make sure I didn’t break anything I added a trim around the

Code: Select all
$ipn["s2member_paypal_proxy_return_url"])


variable on line 279.

By adding the trim statement and testing a number of times the redirect on success consistantly worked which appears to have resolved the fault.

Jason could you confirm and add to your subsequent update.

Peter.
User avatar
peterhuk
Experienced User
Experienced User
 
Posts: 102
Joined: February 12, 2011

Re: Forcing custom redirect after a successful purchase

Postby Cristián Lávaque » July 17th, 2011, 3:32 pm

I'm glad you solved the problem. :)
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


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

cron