Skip to content

Commit

Permalink
Enhancement: Use saveAssociated in admin_add/edit
Browse files Browse the repository at this point in the history
Requesting a change for admin_add and admin_edit to use saveAssociated, so plugins can extend the core to save extra associated fields.

Related to #618

Closes #639
  • Loading branch information
phpMagpie authored and rchavik committed Apr 25, 2015
1 parent d3b61cc commit 5642a0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Users/Controller/UsersController.php
Expand Up @@ -164,7 +164,7 @@ public function admin_add() {
if (!empty($this->request->data)) {
$this->User->create();
$this->request->data['User']['activation_key'] = md5(uniqid());
if ($this->User->save($this->request->data)) {
if ($this->User->saveAssociated($this->request->data)) {
$this->request->data['User']['id'] = $this->User->id;
$this->__sendActivationEmail();

Expand All @@ -190,7 +190,7 @@ public function admin_add() {
*/
public function admin_edit($id = null) {
if (!empty($this->request->data)) {
if ($this->User->save($this->request->data)) {
if ($this->User->saveAssociated($this->request->data)) {
$this->Session->setFlash(__d('croogo', 'The User has been saved'), 'flash', array('class' => 'success'));
return $this->Croogo->redirect(array('action' => 'edit', $this->User->id));
} else {
Expand Down

0 comments on commit 5642a0b

Please sign in to comment.