[eluser]Solarpitch[/eluser]
Hey guys,
this is more of a problem than a question but here it goes... I've installed Redux and modified the config files and that. I am able to register a user to the database.
The problem occurs when I try to check
if the username exists or if I try to determine if the user is logged in using
logged_in()
Here's what I have...
Code:
class User extends Controller
{
function User()
{
parent::Controller();
$this->load->helper('url');
$this->load->model('product_model');
$this->load->helper('form');
}
function register ()
{
// Required Field Rules.
$rules['username'] = "required";
$rules['password'] = "required";
$rules['password2'] = "required";
$rules['email'] = "required";
$rules['question'] = "required";
$rules['answer'] = "required";
//When I call this function and submit the form, the page just reloads and the form
disappears. It wont print a message telling me that the username already exists.
$rules['username'] = "callback_check_username";
$this->validation->set_rules($rules);
// Required Field Names
$fields['username'] = "Username";
$fields['password'] = "Password";
$fields['password2'] = "Repeat Password";
$fields['email'] = "Email Address";
$fields['question'] = "Secret Question";
$fields['answer'] = "Secret Answer";
$this->validation->set_fields($fields);
if ($this->validation->run())
{
// Validation Passed
$redux = $this->redux_auth->register
(
$this->input->post('username'),
$this->input->post('password'),
$this->input->post('email'),
$this->input->post('question'),
$this->input->post('answer')
);
// The reason we put the method into a variable is so we can deal
// with the different return messages.
// I use a switch statement to deal with the different return
// messages produced by the registration method.
switch ($redux) {
case 'REGISTRATION_SUCCESS':
# code...
break;
case 'REGISTRATION_SUCCESS_EMAIL':
# code...
break;
case false:
# code...
break;
case true:
# code...
break;
}
}
else
{
$this->load->view("users/register");
}
}
}