By Stay in Bed Media on Monday, 20 October 2014
Posted in Technical Issues
Likes 0
Views 898
Votes 0
Hi there,

I need to create a user programmatically from my custom component, perhaps in ajax, there is no way to do this on http://docs.stackideas.com/developers/users/users

Someone can help me ?
Hello,

Hm, you could actually take a look at those codes in /components/com_easysocial/controllers/registration.php as the workflow for user account creation is already there
·
Monday, 20 October 2014 23:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,
On easysocial 1.2.16 I used

$data = array(
"name" => $username,
"username" => $username,
"password" => $password,
"email" => $email
);
$profile = $profileModel->getDefaultProfile();
$user = $registrationModel->moduleCreateUser($profile->id, $data);


But on easysocial 1.3.8 moduleCreateUser disappeared, i tried

$data = array(
"name" => $username,
"username" => $username,
"password" => $password,
"email" => $email
);

$profile = $profileModel->getDefaultProfile();
$registration = FD::table('Registration');
$registration->load();
$registration->profile_id = $profile->id;
$registration->values = FD::json()->encode($data);
$registration->store();

$user = $registrationModel->createUser($registration);


and I obtain a sql error :

Unknown column 'privacy' in 'field list' SQL=UPDATE `#__social_users` SET `alias`=NULL,`state`='2',`params`='',`connections`='0',`type`='joomla',`permalink`='',`auth`='',`completed_fields`='0',`privacy`=NULL WHERE `user_id`='784'
·
Tuesday, 21 October 2014 20:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, it seems like your files is probably outdated?
·
Tuesday, 21 October 2014 23:00
·
0 Likes
·
0 Votes
·
0 Comments
·
What should i do to get the same result as before ?
·
Tuesday, 21 October 2014 23:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry but I really have no idea why you are hitting those errors. I can only assume that your model files is outdated. It's best that you refer to the codes in the model file under the method @createUser
·
Tuesday, 21 October 2014 23:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Another way could be to do it with the JTable!
·
Thursday, 23 October 2014 05:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Alexandre,

You can't possibly just do this with JTable unfortunately because there's some custom logics in the user creation workflow.
·
Friday, 24 October 2014 03:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,
I found the origin of this bug, it's an incompatibility between easysocial 1.3.8 and the FaLang plugin (for the multilingual) but easysocial 1.3.10 fixes the bug.

Thanks
·
Friday, 24 October 2014 21:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the heads up on this, glad that your issues are resolved now
·
Friday, 24 October 2014 21:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post