[SOLVED] Creating Users through API

13 years 4 days ago - 12 years 11 months ago #162590 by clickmo
[SOLVED] Creating Users through API was created by clickmo
I followed the tutorial found: www.allmysocials.com/tutorials/item/237-create-users-through-api

I also included all dependencies as outlined: www.allmysocials.com/tutorials/item/231-include-api-externally

When calling: registerUser( "Test", "Test", strip_tags($_POST), "Usertest", "12345" )

the return value is False. I'm assuming something failed somewhere. When checking the database, the user was created inside of jos_users successfully. So what's the process that is done inside of $row->store() that would fail?

How do you check what parts it failed on or the errors that were spat out upon failure?

Please Log in to join the conversation.

13 years 3 days ago #162645 by krileon
Replied by krileon on topic Re: Creating Users through API
You'd need to output $row->getError() to see what happened during the storing process.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 11 months ago - 12 years 11 months ago #165540 by clickmo
Replied by clickmo on topic Re: Creating Users through API
I'm debugging the function and I'm having $row->store() return false the first time it is being called. My alert saying Store(): FALSE pops up but the getError alert does not appear and the function returns false.

I'm a little unfamiliar with the inner classes of community builder so could you point me to the location where I can find where the store() function of moscomprofilerUser is so I can try and track down why this is happening without returning any errors.

I found moscomprofilerUser inside of cb.tables.php but I can't find moscomprofiler to see the functions.
if ( $row->store() ) {
		if ( ( $row->confirmed == 0 ) && ( $confirmation != 0 ) ) {
			$row->_setActivationCode();
			if ( ! $row->store() ) {
				return false;
			}
		}
		return true;
	}
	echo "<SCRIPT LANGUAGE='javascript'> alert('Store(): FALSE'); </SCRIPT>";
 	echo "<SCRIPT LANGUAGE='javascript'> alert('Error"  . $row->getError() . "'); </SCRIPT>";
	return false;

Please Log in to join the conversation.

12 years 11 months ago #165541 by clickmo
Replied by clickmo on topic Re: Creating Users through API
Nevermind I found it. Didn't realize it had a defaulted parameter passed to it so searching for store() returned nothing.

Please Log in to join the conversation.

12 years 11 months ago #165564 by clickmo
Replied by clickmo on topic Re: Creating Users through API
Ok, I'm at a loss now. I followed the error all the way back to
function insertObject( $table, &$object, $keyName = NULL, $verbose=false ) {
		return $this->_db->insertObject( $table, $object, $keyName, $verbose );
	}

from what I see, this calls itself over and over again. I took a deeper look and $table is valid, $object is not null, $keyName is 'id' and verbose is blank. I even tried making verbose 0 just to be sure but it does nothing.

$this->_db->insertObject( $table, $object, $keyName, $verbose ); always return nothing. Any thoughts on why this would be returning nothing?

Please Log in to join the conversation.

12 years 11 months ago #165565 by clickmo
Replied by clickmo on topic Re: Creating Users through API
I'm going to be posting a lot more often now because we appear to fix the problem as soon as we post on the forum. The issue was I was passing a bad variable into $row.

At least I have a much better understanding of the user backbone now.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.225 seconds

Facebook Twitter LinkedIn