(s2Member). New API Notification. New "Modification" Notification now available under: s2Member -> API Notifications. Say that three times fast!
Statistics: Posted by Jason Caldwell — June 5th, 2011, 8:56 pm
$user->set_role ("s2member_level" . $paypal["level"]); /* (upgrade/downgrade) */
function set_role( $role ) {
foreach ( (array) $this->roles as $oldrole )
unset( $this->caps[$oldrole] );
if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
return;
if ( !empty( $role ) ) {
$this->caps[$role] = true;
$this->roles = array( $role => true );
} else {
$this->roles = false;
}
update_user_meta( $this->ID, $this->cap_key, $this->caps );
$this->get_role_caps();
$this->update_user_level_from_caps();
do_action( 'set_user_role', $this->ID, $role );
}
Statistics: Posted by Jason Caldwell — April 7th, 2011, 8:43 am
add_action('set_user_role', 'my_role_change_handler', 1, 2);
function my_role_change_handler($user_id, $new_role) {
if ( function_exists('my_rpc_function') ) {
my_rpc_function($user_id);
} else {
wp_mail( 'john@xxxxx.com', 's2hacks', 'my_rpc_function not available');
}
}
Statistics: Posted by johnleblanc — April 4th, 2011, 6:47 pm
<?php
add_action("set_user_role", "my_role_change_handler", 1, 2);
function my_role_change_handler($user_id, $new_role){
if($new_role === "s2member_level1")
{ /* Do something here? */ }
}
}
?>
Statistics: Posted by Jason Caldwell — April 4th, 2011, 3:45 am
0 => 'IPN received on: Mon Apr 4, 2011 7:56:59 am UTC',
1 => 's2Member POST vars verified with a Proxy Key',
2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
3 => 's2Member txn_type identified as (web_accept|subscr_signup).',
4 => 's2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.',
5 => 's2Member Level/Capabilities updated w/ advanced update routines.',
6 => 'Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.',
7 => 'Storing IPN signup vars now. These are associated with a User\'s account record; for future reference.',
0 => 'Unable to verify POST vars. Possibly caused by a fraudulent request. If this error continues, please run IPN tests against your server from a PayPal® Sandbox account. They provide special diagnostic tools to assist you.',
1 => 'If you\'re absolutely SURE that your PayPal® configuration is valid, you may want to run some tests on your server, just to be sure $_POST variables are populated, and that your server is able to connect to PayPal® over an HTTPS connection.',
2 => 's2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows® server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows® server.',
Statistics: Posted by johnleblanc — April 4th, 2011, 3:27 am
johnleblanc wrote:
Would it make sense to add an additional Subscription Modification Notifications section within the s2Member API / Notifications settings?
In the meantime, what is a good hook for me to use if I want to trigger a function every time a user level is altered?
<?php
add_action("set_user_role", "my_role_change_handler", 10, 2);
function my_role_change_handler($user_id, $new_role){
if($new_role === "s2member_level1")
{ /* Do something here? */ }
}
?>
Statistics: Posted by Jason Caldwell — April 4th, 2011, 2:35 am
Statistics: Posted by johnleblanc — April 4th, 2011, 2:18 am
Statistics: Posted by Jason Caldwell — April 4th, 2011, 2:09 am
array (
'txn_type' => 'subscr_signup',
'subscr_id' => 'xxxxx',
'custom' => 'www.xxxxx.com',
'txn_id' => 'xxxxx',
'period1' => '0 D',
'period3' => '1 M',
'mc_amount1' => '0.00',
'mc_amount3' => '4.95',
'mc_gross' => '4.95',
'mc_currency' => 'USD',
'tax' => '0.00',
'recurring' => '4.95',
'payer_email' => 'xxxxx@xxxxx.com',
'first_name' => 'John',
'last_name' => 'LeBlanc',
'option_name1' => 'Updating Subscr. ID',
'option_selection1' => '40',
'item_name' => 'UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
'item_number' => '1',
'proxy_verified' => 'paypal',
's2member_log' =>
array (
0 => 'IPN received on: Mon Apr 4, 2011 4:57:18 am UTC',
1 => 's2Member POST vars verified with a Proxy Key',
2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
3 => 's2Member txn_type identified as (web_accept|subscr_signup).',
4 => 's2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.',
5 => 's2Member Level/Capabilities updated w/ advanced update routines.',
6 => 'Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.',
7 => 'Storing IPN signup vars now. These are associated with a User\'s account record; for future reference.',
),
'subscr_gateway' => 'paypal',
'eotper' => NULL,
'ccaps' => NULL,
'level' => '1',
'initial_term' => '0 D',
'initial' => '4.95',
'regular' => '4.95',
'regular_term' => '1 M',
's2member_paypal_proxy' => 'paypal',
's2member_paypal_proxy_use' => 'pro-emails',
's2member_paypal_proxy_verification' => 'xxxxx',
)
Statistics: Posted by johnleblanc — April 4th, 2011, 1:07 am
Statistics: Posted by Jason Caldwell — April 4th, 2011, 12:56 am
array (
'payment_cycle' => 'Monthly',
'txn_type' => 'recurring_payment_profile_created',
'last_name' => 'LeBlanc',
'next_payment_date' => '03:00:00 Apr 04, 2011 PDT',
'residence_country' => 'US',
'initial_payment_amount' => '0.00',
'rp_invoice_id' => 'xxxxx',
'currency_code' => 'USD',
'time_created' => '21:57:16 Apr 03, 2011 PDT',
'verify_sign' => 'xxxxx',
'period_type' => 'Regular',
'payer_status' => 'unverified',
'tax' => '0.00',
'payer_email' => 'xxxxx@xxxxx.com',
'first_name' => 'John',
'receiver_email' => 'xxxxx@xxxxx.com',
'payer_id' => 'xxxxx',
'product_type' => '1',
'shipping' => '0.00',
'amount_per_cycle' => '4.95',
'profile_status' => 'Active',
'charset' => 'windows-1252',
'notify_version' => '3.1',
'amount' => '4.95',
'outstanding_balance' => '0.00',
'recurring_payment_id' => 'xxxxx',
'product_name' => 'UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
's2member_log' =>
array (
0 => 'IPN received on: Mon Apr 4, 2011 4:57:20 am UTC',
1 => 's2Member POST vars verified through a POST back to PayPal®.',
2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
3 => 's2Member txn_type identified as recurring_payment_profile_created.',
4 => 'The txn_type does not require any action on the part of s2Member.',
5 => 's2Member Pro handles this event on-site, with an IPN proxy.',
),
'subscr_gateway' => 'paypal',
'custom' => 'www.xxxxx.com',
'item_number' => '1',
'subscr_id' => 'xxxxx',
'item_name' => 'UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)',
)
Statistics: Posted by johnleblanc — April 4th, 2011, 12:45 am
Statistics: Posted by Jason Caldwell — April 4th, 2011, 12:28 am
[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="UPGRADE TO PLUS MEMBERSHIP. Just $4.95US/mo. (billed monthly)" ps="paypal" cc="USD" ns="1" custom="www.example.com" ta="0" tp="0" tt="D" ra="4.95" rp="1" rt="M" rr="1" modify="1" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" /]
Statistics: Posted by johnleblanc — April 3rd, 2011, 5:33 pm
Statistics: Posted by Jason Caldwell — April 3rd, 2011, 4:03 pm
Statistics: Posted by johnleblanc — April 3rd, 2011, 3:28 am