[eluser]flaky[/eluser]
Hi
I'm having kind of an issue here, the callback function for email validation is never called, I have no clue why it isn't being called, I even removed all the validation (required, valid_email) and left only the callback function, but it won't work, here is the complete code. help!!
Some info, if it helps in any way
OS: Windows 7
Web Server: IIS 7
PHP: v5.3
MySQL: v5.1.37
Code:
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require_once(BASEPATH . 'application/controllers/blog' . EXT);
class User extends Blog{
public function User(){
parent::Blog();
//Load helpers
$this->load->helper('form');
//Load libraries
$this->load->library('form_validation');
//Load models
$this->load->model('user_model');
}
public function index(){
$this->load->view('user_register');
}
public function register($register=FALSE){
if($register == TRUE){
$this->form_validation->set_rules('user_email', 'Email', 'callback_user_email_check');
$this->form_validation->set_rules('user_password', 'Password', 'required|min_length[6]');
if ($this->form_validation->run() == TRUE){
$data['user_email'] = $this->input->post('user_email');
$data['user_password'] = $this->input->post('user_password');
if(is_uploaded_file($_FILES['user_thumbnail']['tmp_name'])) {
$data['user_thumbnail'] = mysql_real_escape_string(file_get_contents($_FILES['user_thumbnail']['tmp_name']));
$size = getimagesize($_FILES['user_thumbnail']['tmp_name']);
$data['user_thumbnail_type'] = $size['mime'];
}
//If there are no users in the database
//then, this user will be with administrative role and active
//by default
if($this->user_model->count() == 0){
$data['user_role_id'] = 1; //USER_ADMIN
$data['user_status_id'] = 1; //USER_ACTIVE
}
else{
$data['user_role_id'] = 3; //USER_LIMITED
$data['user_status_id'] = 2; //USER_PASSIVE
}
$this->user_model->save($data);
}
else
$this->load->view('user_register');
}
else
$this->load->view('user_register');
}
public function user_email_check($user_email){
$this->form_validation->set_message('user_email_check', "Email already exists");
return $this->user_model->exists($user_email);
}
public function thumbnail($user_id=null){
if($user_id != null){
$thumbnail = $this->user_model->thumbnail($user_id);
header("Content-type: {$thumbnail->user_thumbnail_type}");
echo $thumbnail->user_thumbnail;
}
}
}