Monday, May 21, 2012

Re: V2.1.2 Email Verification after registration

sorry if I read too quickly, but if you need to get the newly inserted id, it is very simple.
here is the example code:

if ($this->OrganizationAddress->save()) {
                // getting newly inserted OrganizationAddress.id
                $newId = $this->OrganizationAddress->id;
}

so, if SAVE was successful, then you just do

$newId = $this->OrganizationAddress->id;

that is all you need for newly inserted id.



On Mon, May 21, 2012 at 1:07 PM, Cody Sortore <rebel2noavail@gmail.com> wrote:
Okay, been working on this for a while, but I cannot figure out what
in the world is going on!

   public function valid() {
       if (!empty($this->passedArgs[0]) && !empty($this-
>passedArgs[1])){
           $username = $this->passedArgs[0];
           $validation = $this->passedArgs[1];
           $results = $this->User->find(null, array('conditions' =>
array('User.username' => $this->passedArgs[0])));
          if ($results['User']['usertype'] == 'valid') {
               if($results['User']['validation'] == $validation) {
                   $results['User']['validation'] = md5(uniqid());
                   $results['User']['usertype'] = 'user';
                   $this->User->save($results);
                   $this->Session->setFlash('Your registration is
complete');
                   $this->redirect(array('action' => 'login'));
               } else {
                   $this->Session->setFlash(__('The validation code
does not match this users validation code.  Please check your email
and make sure you copied it correctly.'));
                   $this->redirect(array('action' => 'login'));
               }
           } else {
               $this->Session->setFlash(__('This user has already
been activated, please login to continue.'));
               $this->redirect(array('action' => 'login'));
           }
       }
   }

There is no view, it's supposed to just go through the controller and
redirect.  If I could figure out how to retrieve the auto_increment
user ID when the user is registered and send it in the auto generated
email I wouldn't have this problem, or if I could retrieve the data
based on the username.  The SQL dump comes up properly formatted calls
everything as I want, but all the data retrieved comes up null.  Well,
not exactly null, it somehow gets the proper user ID for all
associated models... but no data is brought up to check and therefore
fails the check for "valid" as usertype... So, if someone could tell
me what is wrong with my formatting I would be most grateful!  Thank
you in advance for any tips :-D

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Richard Joo

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: