Skip to Content Skip to Menu

[SOLVED] Creating Users through API

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 5 months ago - 13 years 4 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?
Last edit: 13 years 4 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
13 years 5 months 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 or Create an account to join the conversation.

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 months ago - 13 years 4 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.
Code:
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;
Last edit: 13 years 4 months ago by clickmo. Reason: additional information found

Please Log in or Create an account to join the conversation.

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 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 or Create an account to join the conversation.

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 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
Code:
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 or Create an account to join the conversation.

  • clickmo
  • clickmo
  • OFFLINE
  • Posts: 55
  • Thanks: 1
  • Karma: 1
13 years 4 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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum