title: Codeigniter form validation callback not working
body: <p>I'm trying to extend the validation class with my own function but it seems to skip the check.</p>
  
  <p><strong>My code</strong></p>
  
  <pre><code>public function login_validation(){
   $this-&gt;load-&gt;library('form_validation');
   $this-&gt;form_validation-&gt;set_rules('email', 'Email', 'trim|required|valid_email|xss_clean|callback_validate_credentails');
   $this-&gt;form_validation-&gt;set_rules('password', 'Password', 'trim|required|md5');
      if($this-&gt;form_validation-&gt;run()){
          #redirect('home');
          //Just to check 
          echo "login success";
      }
      else{
          $this-&gt;load-&gt;view('view_login');
      }
  }
  </code></pre>
  
  <p>My validate credentails function goes like this;</p>
  
  <pre><code>public function validate_credentials(){
     //loads model_user
     $this-&gt;load-&gt;model('model_users');
     //checks if login_validate function in model_users return true
      if($this-&gt;model_users-&gt;login_validate()){
          return true;
      }
      else{
          //set validation message
          $this-&gt;form_validation-&gt;set_message('validate_credentails','Incorrect Username/Password');
          return false;
      }
  
  }
  </code></pre>
  
  <p>My login_validate function in model_users if needed;</p>
  
  <pre><code>public function login_validate(){
      $this-&gt;db-&gt;where('email', $this-&gt;input-&gt;post('email'));
      $this-&gt;db-&gt;where('password', md5($this-&gt;input-&gt;post('password')));
      $query = $this-&gt;db-&gt;get('users');
      if($query-&gt;num_rows() == 1){
          return true;
      }
      else {
          return false; 
          }
  
  }
  </code></pre>
  
  <p>This is the first time i've had this problem, am i doing something wrong? I've spent too much time on this :( </p>