links for 2008-06-06


Software developer by day, scale model builder and wargamer by night.

Posted in 15
3 comments on “links for 2008-06-06
  1. Joener says:

    Hi Richard,

    Can you help me to figure out. What the problem in my code.
    When i try to register, it didnt save to my database. and didnt sent to the email address of the uernae name email.

    Kindly refer to my code below.

    //Users controller

    class UsersController extends AppController
    var $name=’Users’;
    var $helpers= array(‘Html’,’Form’);
    var $components = array(‘Email’,’Auth’);

    function signup()

    if (!empty($this->data))
    $this->data[‘User’][‘password2hashed’] = $this->Auth->password($this->data[‘User’][‘password2’]);

    $this->data[‘User’][‘confirm_code’] = String::uuid();


    if ($this->User->save($this->data))
    $this->Email->to = $this->data[‘User’][’email’];
    $this->Email->subject = ‘Confirmation’;
    $this->Email->replyTo = ‘’;
    $this->Email->from = ‘Quickwall
    $this->Email->sendAs = ‘html’;
    $this->Email->template = ‘confirmation’;
    $this->set(‘code’, $this->data[‘User’][‘confirm_code’]);

    $this->Session->setFlash(‘Confirmation mail sent.Please check your inbox’);
    $this->redirect(array(‘controller’ => ‘questions’,’action’=>’home’));
    $this->Session->setFlash(‘There was a problem sending
    the confirmation mail. Please try again’);

    $this->Session->setFlash(‘There was an error signing up.
    Please, try again.’);

    $this->data = null;


    //confirm function

    function confirm($user_id=null, $code=null) {

    if(empty($user_id) || empty($code))
    $this->set(‘confirmed’, 0);
    $user = $this->User->read(null, $user_id);
    if(empty($user)) {
    $this->set(‘confirmed’, 0);
    if($user[‘User’][‘confirm_code’] == $code){
    $this->User->id = $user_id;
    $this->User->saveField(‘confirmed’, ‘1’);
    $this->set(‘confirmed’, 1);
    } else {
    $this->set(‘confirmed’, 0);


    Hi ,
    Thank you for signing up in Quickwall. To complete the sign up
    process please click on the link below:
    <a href="http://
    url(array(‘controller’ => ‘users’, ‘action’ => ‘confirm’));
    ?>//”>Confirm your account


    Sign Up Confirmation

    Congratulations! You have successfully confirmed your
    account. Now you can login.

    Invalid Confirmation. Please sign up.

  2. Joener says:

    Hope you can help me. Thanx

  3. Hi Joener

    I don’t check back on this blog very ofter, I’ve moved to

    My first guess is that you new user is failing to validate so it isn’t saving and it’s failing for one of the fields you are not displaying on your registration form.

    You can add the following to the bottom of your signup function to output all the errors associated with it:

    echo pr($this->User->validationErrors);

    Hope this helps

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: