title: Signup email activation confirmation issue. Activation code string missing from email URL even though concatenated
body: <p>I have this method:</p>
  
  <pre><code>public function activation_code() 
  { //activation code sent into db
    $activation_code = random_string('alnum', 32);
    return $activation_code;
  }  
  </code></pre>
  
  <p>What I'm trying to do is provide this with the post data that gets sent to my database but also provide a copy of that same activation code so I can concatenate it with the "click here to confirm email" url that is in my confirmation email that is sent to users upon registration.</p>
  
  <p>How can I do this? I can't provide the method because if I do the database code and the email URL code will be different so user wouldn't be able to match them and confirm their email address.</p>
  
  <p>I've tried many other ways such as providing the method in one place e.g. </p>
  
  <pre><code>public function create() 
  { //get post data and insert into db
  
    $dbcolumn-&gt;group_id = 2; //group 1 for admin group 2 for member
    $dbcolumn-&gt;first_name = $this-&gt;input-&gt;post('first_name');
    $dbcolumn-&gt;last_name = $this-&gt;input-&gt;post('last_name');
    $dbcolumn-&gt;email = $this-&gt;input-&gt;post('email');
    $dbcolumn-&gt;password = $this-&gt;hashed();
    $dbcolumn-&gt;birthday = $this-&gt;input-&gt;post('year') . 
      '-' . $this-&gt;input-&gt;post('month') . '-' . $this-&gt;input-&gt;post('day');
    $dbcolumn-&gt;sex = $this-&gt;input-&gt;post('sex');       
    $dbcolumn-&gt;activation_code = $this-&gt;activation_code();
    // date and time user joined the website
    $dbcolumn-&gt;created_on = date('Y-m-d H:i:s', now()); 
    $this-&gt;db-&gt;insert('users', $dbcolumn);
  }
  </code></pre>
  
  <p>If you look at the dbcolumn->activation code line you'll see what I've done. That works and the code is stored in the database. If I provide the same "$this->activation_code() method to the email that's sent the codes will obviously be different.</p>
  
  <pre><code>public function send_confirmation_email() 
  { //receives variable from create method
    $this-&gt;load-&gt;library('email');
    $this-&gt;email-&gt;from('wengerarsen@gmail.com', 'my site');
    $this-&gt;email-&gt;to($this-&gt;input-&gt;post('email'));
    $this-&gt;email-&gt;subject('my site - Activate your account');
    //copy of activation code returned from create method
    $this-&gt;email-&gt;message('We\'re back, please click the link to activate your account ' . anchor('http://mysite.com/activation/' . $this-&gt;activation_code(), 'Activate my account'));
    $this-&gt;email-&gt;send();
  }
  </code></pre>
  
  <p>As you can see I have the same method $activation_code() pulled into my send confirmation email method. This will just generate a whole new code meaning I won't be able to match the database activation code and the URI segment code in the users email.</p>
  
  <p>I have tried to make the variable in the return public and call it in the send confirmaton email method but it doesn't work. The code ends up missing from he end of the URL in the email.</p>
  
  <p>I've tried so many different ways and nothings working.</p>
  
  <p>Maybe I'm missing something here?</p>
  
  <p>Advice, examples etc will be much appreciated.</p>