On Dec 17, 9:56 am, gearvOsh <[email protected]> wrote:
> Nope, still doesn't work. This seems like a lot of hassle/steps in
> between just to do something simple like update.
That's a lot of fat controller code for something as simple as that
too ;). e.g. You should almost never need to do this in a controller
"$this->User->invalidate..".
Of the snippet you pasted, your controller code should be *no more*
than
function xyz($a, $param) {
if ($this->data) {
..
if ($this->User->save($data, extra, params)) {
$this->Session->setFlash('success');
$this->redirect('/wherever');
}
..
}
AD
>
> Heres a snippet of my code:
>
> if ($this->User->validates()) {
> $userObj = $this->User->find('first', array(
> 'conditions' => array(
> 'User.username' => $this->data['User']['username'],
> 'User.password' => $this->data['User']['password'],
> 'User.hash' => $hash
> ),
> 'fields' => array('User.id', 'User.signupDate')
> ));
>
> if (!empty($userObj)) {
> $this->User->create();
> $this->User->id = $userObj['User']['id'];
>
> if ($this->User->verifyEmail($userObj['User']['signupDate'],
> $this->Settings->grab('email_verify_exp_hours'))) {
> $this->User->saveField('status', 'active');
> } else {
> $this->User->invalidate('', sprintf(__d('errors',
> 'verifyTimeElapsed', true), $this->Settings->grab
> ('email_verify_exp_hours')));
> $this->User->saveField('status', 'inactive');
> }
> } else {
> $this->User->invalidate('', __d('errors', 'verifyFailure',
> true));
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---