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™

Registration Notification URL Not Firing... Debug?

s2Member Plugin. A Membership plugin for WordPress®.

Registration Notification URL Not Firing... Debug?

Postby tkittredge » August 29th, 2011, 4:08 pm

I am having a problem getting a simple test notification URL to fire (from any event). The script (without query string parameters, no replacement codes) simply opens a text file and writes a line of text (to confirm success). It works when called from a browser address bar or from within WordPress using javascript:window.open but not when configured in s2Member -> API / Notifications -> Registration Notifications. It also works when called from PayPal IPN Simulator Test Tools.

What is the best method to debug the call? Am I missing some other configuration / hosting requirement for s2M?
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Registration Notification URL Not Firing... Debug?

Postby Cristián Lávaque » August 29th, 2011, 5:41 pm

The thing is that the notification URL is being loaded by s2Member in that case, not the user, so the page is being served to your s2Member, which is why you don't see it in the browser.

If you have s2Member Pro http://s2member.com, you can either specify the URL as the one to show the user after payment, or you can customize the s2Member one.

WP Admin -> s2Member -> Paypal Buttons -> Shortcode Attributes -> success
WP Admin -> s2Member -> PayPal Options -> PayPal PDT -> Auto-Return Page Template


I hope that helps. :)
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: Registration Notification URL Not Firing... Debug?

Postby tkittredge » August 30th, 2011, 8:57 am

Slight miss understanding. Although I'd used window.open to test one scenario, the simple test script (below) has no UI and simply writes to a file to confirm it is getting fired (no presentation in intended)...

<?php /* Usage: http://domain.com/notification_test.php */

$file = "notification_test.txt";
$data = 'success!';
file_put_contents($file, $data);

?>

This creates a 'success!' entry in the file (notification_test.txt) when fired from a browser address bar, from PayPal IPN Test environment, and from within WP using window.open, however NOT from s2Member API / Notifications (I'm testing in sandbox mode.)

Is there a way for me to understand/debug/confirm that the test is firing from s2Member API / Notifications?
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Registration Notification URL Not Firing... Debug?

Postby tkittredge » August 30th, 2011, 2:40 pm

Okay. Not quite out of the woods, but beginning to find an answer after digging into s2Member code a bit...

I discovered that the remote() function of the c_ws_plugin__s2member_utils_urls class in the utils-urls.inc.php file in the /wp-content/plugins/s2member/includes/classes/ directory uses wp_remote_request() to fire the notification urls.

So... I plugged wp_remote_post() into my test case and it returned "Couldn’t resolve host ‘my.domain.com’". So I plugged in the IP address into the s2member API / Notifications configuration instead of the domain name and it now fires successfully and runs the script.

Not sure why the domain name is not resolving (it's the same domain as where the notification request is running, complete with http://... (non-relative)) but there appears to be a DNS issue of some type.

It would be nice if the s2Member Notification URL could log a return value when fired for debugging purposes. Perhaps this is the case and I've missed it.

So, other than the domain name not being resolved, problem solved. Any clues to that problem appreciated!
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Registration Notification URL Not Firing... Debug?

Postby Cristián Lávaque » August 30th, 2011, 6:49 pm

Glad you managed to make it work like that! :)

I'll email Jason about your other questions. I'm pretty sure the Notifications API doesn't have a logging or debugging routine, that's up to the script that it calls, I guess, but I can understand that there's stuff before the script is even called. I'll wait for Jason's comments.
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: Registration Notification URL Not Firing... Debug?

Postby Jason Caldwell » August 31st, 2011, 12:14 am

Thanks for the heads up on this thread.
Is there a way for me to understand/debug/confirm that the test is firing from s2Member API / Notifications?

One way to further test API Notifications is to enter an email address for each of the Notifications. That way you'll get an email when each of these Notifications are fired, and if your URL did not get called upon, you'll at least know the event did fire, it's just that your URL failed in one way or another.
~ 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: Registration Notification URL Not Firing... Debug?

Postby tkittredge » August 31st, 2011, 8:37 am

Yup, agreed that using the email argument and receiving notification that the event had fired is useful. Reporting/examining the information returned in the WP_Error class by wp_remote_request() to determine how...
your URL failed in one way or another
...could also help.

So, the debug solution is archived here for anyone having the same problem to check... call wp_remote_post and check the return. Run from a WP page...

<!-- API Notification Test -->
<?php
$result = wp_remote_post('<put your notification url here>');
echo print_r($result);
?>

In any case, not sure why I'm having a problem resolving the domain name and the IP address works, but that's a matter for another thread!
T
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Registration Notification URL Not Firing... Debug?

Postby Jason Caldwell » August 31st, 2011, 12:41 pm

Thanks for the follow-up. Yep, that's a good idea too. I'll see what we can do about that in a future release. It might be helpful to log those connection details. Regarding the DNS issue, I would contact your hosting company on that one, or consult with your sys admin. It sounds like the server may have a DNS configuration problem ( i.e. it's unable to resolve domains ).
~ 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: Yahoo [Bot] and 2 guests

cron