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™

Signup/Registration Notification Key %%subscr_id%% ?

s2Member Plugin. A Membership plugin for WordPress®.

Signup/Registration Notification Key %%subscr_id%% ?

Postby tkittredge » August 19th, 2011, 8:05 pm

In the context of s2Member API Notifications, which replacement codes or data are the keys between Signup Notifications and Registration Notifications?

If I fire a script (URL) and capture data as a result of a signup notification and then another as a result of the registration notification, since the two are independent of one another (if/when the user chooses to complete registration) how can I link the two data sets? Does <?php $subscr_id = get_user_option("s2member_subscr_id", %%user_id%%); ?> fired as a result and at the time of a registration event return the $subscr_id guaranteed to be the key against the %%subscr_id%% value returned at time of signup?

Shouldn’t %%subscr_id%% also be returned with the registration event by s2M?

T
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Signup/Registration Notification Key %%subscr_id%% ?

Postby Cristián Lávaque » August 19th, 2011, 10:39 pm

Here's a video that explains the Notifications API: http://www.s2member.com/api-tracking-no ... ons-video/ I seem to remember Jason explaining what the replacement codes there.

Let me know if it 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: Signup/Registration Notification Key %%subscr_id%% ?

Postby tkittredge » August 21st, 2011, 7:29 pm

Thanks Cristian for the video link.

Is there a way to link the data collected at the time of signup with the data returned at time of registration? None of the data returned by the two events links one to the other...

Signup...

%%subscr_id%%
%%initial%%
%%regular%%
%%recurring%%
%%first_name%%
%%last_name%%
%%full_name%%
%%payer_email%%
%%item_number%%
%%item_name%%
%%initial_term%%
%%regular_term%%

Registration...

%%role%%
%%level%%
%%ccaps%%
%%auto_eot_time%%
%%user_first_name%%
%%user_last_name%%
%%user_full_name%%
%%user_email%%
%%user_login%%
%%user_pass%%
%%user_id%%

Would <?php $subscr_id = get_user_option("s2member_subscr_id", %%user_id%%); ?> during a registration event be guaranteed to be the key against the %%subscr_id%% value returned at time of signup?

Shouldn’t %%subscr_id%% also be returned with the registration event by s2M?
T
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Signup/Registration Notification Key %%subscr_id%% ?

Postby Cristián Lávaque » August 22nd, 2011, 10:31 pm

Subscriber ID has to do with the gateway, which is related to signup (payment), not registration (account creation). You could try the full name or email values, I'm guessing they'd be the same, but may not always be. I'll ask Jason.
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: Signup/Registration Notification Key %%subscr_id%% ?

Postby tkittredge » August 23rd, 2011, 9:32 am

The name and email values return between signup and registration events are not necessarily the same.

Since in my scenario I am calling script to record the information from the two independent events as they naturally occur (subscription and registration events), we need a way to key the two datasets together.

Would <?php $subscr_id = get_user_option("s2member_subscr_id", %%user_id%%); ?> invoked as a result of the registration event be guaranteed to be the key against the %%subscr_id%% value returned with the signup event?

Shouldn’t %%subscr_id%% also be returned with the registration event by s2M?
T
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Signup/Registration Notification Key %%subscr_id%% ?

Postby Jason Caldwell » August 23rd, 2011, 7:13 pm

Thanks for the heads up on this thread Cristián.
~ and thanks for the great question.

tkittredge wrote:The name and email values return between signup and registration events are not necessarily the same.

Since in my scenario I am calling script to record the information from the two independent events as they naturally occur (subscription and registration events), we need a way to key the two datasets together.

Would <?php $subscr_id = get_user_option("s2member_subscr_id", %%user_id%%); ?> invoked as a result of the registration event be guaranteed to be the key against the %%subscr_id%% value returned with the signup event?

Shouldn’t %%subscr_id%% also be returned with the registration event by s2M?
T
Yea, I'll see what we can do about that. Not all "Registrations" are associated with a Paid Subscr. ID. However if/when they are, you can certainly use: get_user_option("s2member_subscr_id", %%user_id%%); as passed through by the Registration API Notification. If the value returned is non-zero, they ARE a paying Member, if it's empty, they're just registering for free ( i.e. Open Registration is enabled on the site ). When this value is non-zero, it WILL exactly match the value returned in the Signup Notification, so yes.
~ 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: Signup/Registration Notification Key %%subscr_id%% ?

Postby tkittredge » August 24th, 2011, 6:53 am

Jason / Christin Thank you for your confirmation and detail here. We're moving forward! All good!
Todd
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Signup/Registration Notification Key %%subscr_id%% ?

Postby Cristián Lávaque » August 25th, 2011, 12:48 am

:)
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: Signup/Registration Notification Key %%subscr_id%% ?

Postby tkittredge » September 7th, 2011, 3:40 pm

I hate to reopen this (given the high level of support activity), however the core problem persists and the work around involves a change to s2M code.

The data available/returned by the signup and registration events do not share a common key (see the list elsewhere in this thread), so there is no way to relate the two dataset if they are to be captured as a result of the notifications.

I'd implemented a script to call get_user_option("s2member_subscr_id", %%user_id%%), fired at the time of a registration notification event (URL) for a valid subscription. Unfortunately this seems to always return NULL at the time the notification is fired.

As a result, I've had to reluctantly implement a change it core s2M code, specifically adding the following line to the configure_user_registration function in registrations.inc.php just prior to c_ws_plugin__s2member_utils_urls::remote ($url)...

Code: Select all
$url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url);


...and of course pass the %%subscr_id%% substitution string on the notification URL.

This works fine. Am I missing something or is there no other way around changing s2M code? Shouldn't this be included in a future release of s2M (understanding it will return NULL when not ?

T
User avatar
tkittredge
Registered User
Registered User
 
Posts: 20
Joined: May 2, 2011

Re: Signup/Registration Notification Key %%subscr_id%% ?

Postby Jason Caldwell » September 9th, 2011, 6:53 pm

Hi there. Thanks for the follow-up.

Sorry, I just ran a test against your bug report, but I was unable to reproduce this. Can you please post a copy of and/or an excerpt from your PHP script? We'll take a look and see if we can help you out. I can confirm that <?php echo get_user_option("s2member_subscr_id", %%user_id%%); ?> does work inside a custom PHP script tied to s2Member's Registration Notification.

Please note, that is just a code sample using pseudo code. In a real-world example, your custom script would assign the value of %%user_id%% to a query string parameter passed in to your script. So you might have somthing like this configured in your s2Member API Notification for Registrations.
Code: Select all
http://example.com/my-script.php?user_id=%%user_id%%
Inside your script, you would do this:
Code: Select all
<?php echo get_user_option("s2member_subscr_id", $_GET["user_id"]); ?>
~ 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: Google [Bot], Yahoo [Bot] and 2 guests

cron