Welcome Guest, Not a member yet? Register   Sign In
Ion Auth: Trouble with register()
#1

[eluser]nitrammit[/eluser]
I'm trying to build a registration page inside my CodeIgniter application. Everything is going well, but I am getting the following errors once submitting the form for user registration:

Code:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: models/ion_auth_model.php
Line Number: 805

Code:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: models/ion_auth_model.php
Line Number: 807

Code:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Users/Tim/Sites/domain.com/ci/core/Exceptions.php:185)
Filename: libraries/Session.php
Line Number: 672

Code:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Users/Tim/Sites/domain.com/ci/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 546

The errors don't have an effect on the process - the activation email is sent to the submitted email address and everything is fine from there on.

Here is my registration controller:

Code:
function index()

{

    if ( $this->ion_auth->logged_in())

    {

        redirect('', 'location');

    }

    $this->form_validation->set_rules('username', 'username', 'trim|required|min_length[3]|max_length[16]|is_unique[user.username]');
    $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email||max_length[50]|is_unique[user.email]');
    $this->form_validation->set_rules('password', 'password', 'trim|required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']');
    $this->form_validation->set_rules('password_confirm', 'password confirmation', 'required|matches[password]');
    $this->form_validation->set_rules('psn', 'PSN', 'trim|min_length[3]|max_length[16]');

    if ($this->form_validation->run() !== FALSE)

    {

        $username = $this->input->post('username');
        $email = $this->input->post('email');
        $password = $this->input->post('password');

        $additional_data = array(
            'psn' => $this->input->post('psn')
        );

        $registered = $this->ion_auth->register($username, $password, $email, $additional_data);

        if ($registered)

        {

            $this->session->set_flashdata('alert-success', 'Account created. Check your email inbox for activation instructions.');
            redirect('login', 'location');

        }

        else

        {

            $this->session->set_flashdata('alert-error', 'Failed to create your account. Please contact site support if this problem persists.');
            redirect('login', 'location');


        }

    }

    // Load the registration page.

    $this->load->view('register_view');

}
#2

[eluser]nitrammit[/eluser]
All good. I had changed the name of the default group in my database and needed to edit this into my ion_auth config file.




Theme © iAndrew 2016 - Forum software by © MyBB