-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Hi Steinkel, how are you? I hope everything is ok.
I have a question, maybe you can help me...
I was wondering how to add a new user from a regular controller?
I have a controller for items (app/controllers/items_controller.php) and I want to create an user from there, how can I do that?
I tried something like this but is not working, can you give me a hand, please
class itemController extends AppController {
public function add() {
$this->Item->create();
if ($this->Item->save($this->data)) {
// create/save new user
$data['User']['id'] = null;
$data['User']['username'] = 'johnsmith1234';
$data['User']['password'] = '123456';
$data['User']['confirm_password'] = '123456';
$data['User']['email'] = 'jed@bodegasale.com';
$data['User']['first_name'] = 'John';
$data['User']['last_name'] = 'Smith';
$data['User']['user_group_id'] = '2';
$result = $this->User->save($data);
}
}
}
Thanks for your time! :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels