It looks to me like callback functions don’t work when I extend from MX_Controller. My login callback was the one that made me spot this:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* @package MizuCMS
* @subpackage Controllers
*/
class Dashboard extends CMS_Controller
{
// Admin: Control Panel
function index()
{
$this->template->build('cms/dashboard');
}
// Admin: Log in
function login()
{
// Call validation and set rules
$this->load->library('form_validation');
// Set the validation rules
$this->form_validation->set_rules(array(
array(
'field' => 'email',
'label' => lang('user_email_label'),
'rules' => 'required|trim|callback__check_login'
),
array(
'field' => 'password',
'label' => lang('user_password_label'),
'rules' => 'required|min_length[6]|max_length[20]'
),
));
// If the validation worked, or the user is already logged in
if ($this->form_validation->run() or $this->ion_auth->logged_in())
{
redirect('cms');
}
else
{
$data->messages['error'] = validation_errors();
}
$this->template->set_layout(FALSE);
$this->template->build('cms/login', $data);
}
function logout()
{
$this->ion_auth->logout();
redirect('cms/login');
}
// Callback From: login()
function _check_login($email)
{
if ( ! $this->ion_auth->login($email, $this->input->post('password')))
{
$this->form_validation->set_message('_check_login', $this->ion_auth->errors());
return FALSE;
}
return TRUE;
}
}
_check_login() is never called at all. I threw a exit(‘hai!’) in the first line of the method and got nothing, I’d have a go debugging the error but I’ve already spent almost an hour of work time getting this far. >.<