latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Pro API For Remote Op Issue

Home Forums Community Forum Pro API For Remote Op Issue

This topic contains 6 replies, has 4 voices. Last updated by  Cristián Lávaque 4 years, 10 months ago.

Topic Author Topic
Posted: Wednesday Feb 15th, 2012 at 11:36 pm #5305

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; }

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Thursday Feb 16th, 2012 at 3:25 am #5333

Hi Angela.

Well, the error may be coming from WP itself if trying to create a user with an empty username.

Now, why is it empty if you’re entering one, I don’t know, I guess it could be because it’s in Chinese?

Could you test with user login “testuser” and see if that gives you the error too?

If you create a user with its username in Chinese using the registration form, does it work fine?

Posted: Thursday Feb 16th, 2012 at 3:59 am #5338

Cristian, you were right about the Chinese characters. They do seem to be causing the problem. But the worse part of this is that every single user that will be registering at my site will be Chinese. So, please work out (or request a work out) a fix for this. I really need it.

Posted: Thursday Feb 16th, 2012 at 11:11 pm #5429
Raam Dev
Username: Raam
Staff Member

Angela, you may want to post something on WordPress Support Forums or search Google for solutions to this problem, as it’s related to WordPress and not s2Member.

Posted: Friday Feb 17th, 2012 at 2:14 am #5461

Right.

Do you have this problem when you try registering an account from the default registration form? [hilite mono]/wp-login.php?action=register[/hilite] or that one works fine with Chinese characters in the username?

If that one doesn’t work, it’s a WP problem and you should post about it in their forums or search for other conversations on it.

If that one does work, then the problem would be with the s2Member API.

Let us know how it goes.

Posted: Friday Feb 17th, 2012 at 8:36 pm #5540
Angela Zou
Username: angelaz

Oh, sorry about that. I just tested it. It does seem like WordPress doesn’t really accept Chinese character in the username. Great, one down, two to go…

Angela

Posted: Friday Feb 17th, 2012 at 8:41 pm #5543

Thanks for the update. :)

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.