Hi, I want to give trial period for paid level without using the 0.01 payment, but I want to use Pro API For Remote Op instead. Most of the part is done, and it’s all looking good (print_r for $op[“data”] below), but $result ALWAYS give me a chinese error message that means something like: login name can not be empty.
Problem is:
1- I didn’t translate S2member into Chinese, where did that message come from?
2- I checked the theme’s translation file, didn’t find that phrase anywhere.
3- $op[“data”] is looking good (all required fields filled in), why is there an error?
print_r for $op["data"] + echo $result:
Array ( [user_login] => 王珑 [user_email] => angelaz@example.com [first_name] => 王珑 [last_name] => 王珑 [user_pass] => [s2member_level] => 4 [s2member_auto_eot_time] => 2012-09-01 [custom_fields] => Array ( [trial] => y ) ) 错误! Error: 不能创建登录名为空的用户。
Pro API script:
$op["op"] = "create_user";
$op["api_key"] = "some-key-here";
$op["data"] = array (
"user_login" => $name,
"user_email" => $email,
"first_name" => $name,
"last_name" => $name,
"user_pass" => "",
"s2member_level" => $level,
"s2member_auto_eot_time" => "2012-09-01",
"custom_fields" => array ("trial" => "y"),
);
print_r($op["data"]);
$result = trim (file_get_contents ("http://wanda.example.com/?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))) {
} else { $output .= '错误! ' . $result; }