Page 1 of 1

Pro API For Remote Operations doesnt create complete user

PostPosted: January 20th, 2012, 1:38 pm
by toddlol
Hello,
I'm running the api call as given in the sample code. I've added the key-value pairs for the custom fields we have in s2member pro. The database shows the user in wp_users and the welcome email is sent, but the login doesnt work and the user isnt shown in the wp user list. I have searched the forum a bit and not found this before. Any ideas would be greatly appreciated.

Code: Select all
if(isset($_REQUEST['processor_response_code']) && $_REQUEST['processor_response_code'] == 'A'){
echo "start s2 api connect";
$op["op"] = "create_user"; /* The Remote Operation you're calling upon. */
/**/
$op["api_key"] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; /* Your Remote Ops API Key. */
/* Check your Dashboard for this value, under: `s2Member -> API Scripting -> Remote Operations API`. */
/**/
$op["data"] = array (/**/
"user_login" => "todd2_gateway", /* Required. A unique Username. Lowercase alphanumerics/underscores. */
"user_email" => "todd@XXXXXXXXXXX.com", /* Required. A valid/unique Email Address for the new User. */
"user_pass" => "123456", /* Optional. Plain text Password. If empty, one will be generated. */
"first_name" => "Todd2", /* Optional. First Name for the new User. */
"last_name" => "Gateway2", /* Optional. Last Name for the new User. */
"s2member_level" => "1", /* Optional. Defaults to Level #0 ( a Free Subscriber ). */
//"s2member_ccaps" => "music,videos", /* Optional. Comma-delimited list of Custom Capabilities. */
"s2member_registration_ip" => "123.456.789.100", /* Optional. User's IP Address. If empty, s2Member will fill this upon first login. */
//"s2member_subscr_gateway" => "paypal", /* Optional. User's Paid Subscr. Gateway Code. One of: (paypal|alipay|authnet|ccbill|clickbank|google). */
//"s2member_subscr_id" => "I-DJASODJF8933B", /* Optional. User's Paid Subscr. ID. For PayPal®, use their Subscription ID, or Recurring Profile ID. */
"s2member_custom" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", /* Optional. If provided, should always start with your installation domain name ( i.e. $_SERVER["HTTP_HOST"] ). */
"s2member_auto_eot_time" => "2030-12-25", /* Optional. Can be any value that PHP's ``strtotime()`` function will understand ( i.e. YYYY-MM-DD ). */
"opt_in" => "1", /* Optional. A non-zero value tells s2Member to attempt to process List Servers that you've configured in the Dashboard area. */
"custom_fields" => array ("shirt_size" => "European tailored with vents and french cuffs", "shipping_addy_1" => "", "shipping_addy_2" => "", "city" => "las vegas", "zip" => "89108", "country" => "usa"), /* Optional. An array of Custom Registration Field ID's, with associative values. */
"s2member_notes" => "API call created member", /* Optional. Administrative notations. */
"notification" => "1", /* Optional. A non-zero value tells s2Member to email the new User/Member their Username/Password. */
/* The "notification" parameter also tells s2Member to notify the site Administrator about this new account. */
);
/**/
$result = trim (file_get_contents ("http://XXXXXXXXXXXXXXXXXXXXXXXXXX/?s2member_pro_remote_op=1", false, stream_context_create (array ("http" => array ("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => "s2member_pro_remote_op=" . urlencode (serialize ($op)))))));
/**/
if (!empty ($result) && !preg_match ("/^Error\:/i", $result) && is_array ($user = @unserialize ($result)))
    {
        echo "Success. New User created with ID: " . $user["ID"];
    }
else
    echo "API error reads: " . $result;
}

Re: Pro API For Remote Operations doesnt create complete use

PostPosted: January 23rd, 2012, 5:45 pm
by Raam Dev
Hello,

I just tested this running the latest versions of WordPress (v3.3.1) and s2Member (Version 111220 + s2Member Pro v111220). The user was successfully created and when I refreshed the users list in WordPress, the newly created user appeared.

Could you try disabling all your plugins and running another test? It's possible there's another plugin conflicting somewhere. Also, I suggest deactivating and reactivating s2Member (be sure that Deactivation Safeguards are turned on in WP Admin -> s2Member -> General Options -> Deactivation Safeguards).