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 Integration – CreateUser()

Home Forums Community Forum Pro API Integration – CreateUser()

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

Topic Author Topic
Posted: Wednesday Jul 4th, 2012 at 9:09 am #18293
Randy King
Username: RandyKing

I am having slight difficulty with the Pro API Integration. Everything works EXCEPT it never sends email to the new registrant with their username/password. However, it IS sending email to the site administrator notifying of a new user registration.

What debug methods can I use?

Here’s my S2 PHP hack code (redacted)…

<?php
	$op["op"] = "create_user";
	$op["api_key"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

	$op["data"] = array (/**/
	"user_login" => $_REQUEST["FirstName"].$_REQUEST["LastName"],
	"user_email" => $_REQUEST["Email"],
	"first_name" => $_REQUEST["FirstName"],
	"last_name" => $_REQUEST["LastName"],	
	"custom_fields" => array ("pass_code" => $_REQUEST["IQINPasscode"]),
	"s2member_level" => "0",
	"s2member_notes" => "From Infusionsoft App",
	"opt_in" => "1",
	"notification" => "1",
	);

	$result = trim (file_get_contents ("http://<<mydomain>>/?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;
	}
?> 

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Thursday Jul 5th, 2012 at 12:26 am #18339

Hi Randy.

The notification parameter should be enough to have the user be sent his email…

What are is your configuration like for the New User email? [hilite path]Dashboard -› s2Member® -› General Options -› Email Configuration -> New User[/hilite]

Posted: Friday Jul 6th, 2012 at 7:29 am #18459
Randy King
Username: RandyKing

Cristián,

I think I found it – I customized the message and it started showing up. Then, upon closer scrutiny, I found the previous ones in my Google Apps junk mail folder; apparently, the standard message is too close to something that Google feels is spam. Go figure. It may be worth noting that in the email setup section. :)

Randy

Posted: Saturday Jul 7th, 2012 at 3:14 am #18519

Thanks for the heads up! When you say “standard”, do you mean s2Member’s or WordPress’?

Anyway, glad you solved it! Thanks for the update. :)

Posted: Thursday Jul 19th, 2012 at 3:41 pm #19774
Randy King
Username: RandyKing

Cristián, been out of town, sorry for the delay. By “standard”, I mean the standard message that comes with S2 informing the newly-registered user of his login credentials. There are two factors: 1) Google claims that the message “is similar to others that have been flagged as spam” and 2) the “From:” header is fabricated because I’m not using my own SMTP server – just defaulting to WordPress/Dreamhost; consequently the header may appear spoofed to Google.

NEW QUESTION ON THIS INTEGRATION…

In the part of the code where the conditional is looking at the variable $result, where does the output of that echo statement go? How do I look at that return value?

Posted: Friday Jul 20th, 2012 at 7:37 am #19824

Ah okay. But was it the New User email that WP has or the one customized by s2Member?

Anyway, it’s a good thing that you can edit the email, so it’s not the same as other people’s.

And what solution did you find for the “from” header configuration?

Posted: Friday Jul 20th, 2012 at 7:59 am #19828
Randy King
Username: RandyKing

Oh, I am assuming it was the S2 message because it contained login/password credentials returned to the user as a result of registration. However, at first I had not customized anything, so perhaps it was a vanilla WP message now that I think about it. It was short. I think it really had to do with the discrepancy between the From address and the authenticated return path.

Posted: Friday Jul 20th, 2012 at 10:13 pm #19868

Ah, got it.

Viewing 7 replies - 1 through 7 (of 7 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.