Thanks for reporting these important issues.startasocialnetwork wrote:1) When using a testing gmail address (
xxx+YY@gmail.com) either this script or WP strips out the + sign. Not many users use that Gmail feature, but it's worth noting.
So far I've been unable to reproduce this.
Since the
+ sign is also a URL encoded space, and spaces WILL be removed by WordPress sanitation routines, I suspect that your email address is not getting
URL-encoded before it's posted to the Remote Operations API for s2Member. Or, you can also URL-encode a serialized string of your array, as seen in the example below. Also see:
http://php.net/manual/en/function.urlencode.phpFor example, this email address <
xxx+YY@gmail.com> should be POST'd to the Remote Operations API like this:
xxx%2BYY%40gmail.com. If this problem persists, please post your full PHP code and we'll take a look for you. Please be sure NOT to include any sensitive information though. Such as your API Key. Please X that out for us before posting.
startasocialnetwork wrote:2) I'm not getting a password generated when the last name field is empty. Any ideas on how to get InfusionSoft to create a password first, and then pull this info from that field?
Yes, I believe we have this issue corrected in the development copy. I'm attaching a patch file to this post for you. Please unzip the attached file, and upload to your site, allowing it override your existing copy of
/s2member-pro/includes/classes/remote-ops-in.inc.php( patches an existing installation of s2Member Pro v111105 )This patch will be included in the next official release,
but you can use this file to update this aspect ahead of that, if you prefer.
Sample code for clarity:
- Code: Select all
<?php
$op["op"] = "create_user"; $op["api_key"] = "6f9e092900305e6a5630c3aed5decda6"; $op["data"] = array ("user_login" => "johndoe22", "user_email" => "johndoe+22@example.com", "user_pass" => "456DkaIjsd!", "first_name" => "John", "last_name" => "Doe", "s2member_level" => "2", "s2member_ccaps" => "music,videos", "s2member_registration_ip" => "123.456.789.100", "s2member_subscr_gateway" => "paypal", "s2member_subscr_id" => "I-DJASODJF8933J", "s2member_custom" => "jason.websharks-inc.loc", "s2member_auto_eot_time" => "2030-12-25", "opt_in" => "1", "custom_fields" => array ("my_field_id" => "Some value."), "s2member_notes" => "Administrative notation. Created this User via API call.", "notification" => "1", );
$result = trim (file_get_contents ("http://jason.websharks-inc.loc/?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;
?>
In the source code, see this section:
urlencode (serialize ($op))