CodeIgniter Forums

Full Version: Message: Undefined property: Register::$ezauth
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]v33s[/eluser]
Hi, I am using ez_Auth and I have to solve the problem about registration Wink

I got this message when i press button Register:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Register::$ezauth

Filename: controllers/register.php

Line Number: 13

Fatal error: Call to a member function authorize() on a non-object in C:\Program Files\VertrigoServ\www\xxx\application\controllers\register.php on line 13

My controller:

Code:
<?php

class Register extends Controller
{
    function __contruct()
    {
        parent::Controller();
        $this->load->model('EzAuth_Model', 'ezauth');
    }

function index()
    {
        $data = array();
        $rules = array(
            'username'                =>    'trim|required|min_length[5]|max_length[30]',
            'email'                    =>    'trim|required|valid_email',
            'password'                =>    'required|matches[password_repeat]',
            'password_repeat'        =>    'required');
        $fields = array(
            'username'                =>    'username',
            'email'                    =>    'email',
            'password'                =>    'pass',
            'password_repeat'        =>    'pass repeat'
        );
        $this->validation->set_rules($rules);
        $this->validation->set_fields($fields);

        if ($this->validation->run())
        {
            $inp = array(
                'ez_users'    =>    array(
                    'username'        =>    $this->input->post('username'),    
                    'email'            =>    $this->input->post('email')
                ),
                'ez_access_keys' => array(
                    'profile_view'      => 'user',
                    'peofile_edit'      => 'user',
                    'profile_payment' => 'user',
                    'profile_add'      => 'user',
                    'profile_logout'  => 'user',
                ),
                'password'    =>    $this->input->post('password'),
            );
            $user_reg = $this->ezauth->register($inp);
            if ($user_reg['reg_ok'] == 'yes') {
                $v_code = $user_reg['code'];

                $message = 'msg !!!!!!';
                
                $this->_send_mail($inp['ez_users']['email'], 'verify', $message);
                
            }
            if ($user_reg['reg_ok'] == 'yes') {
                $this->load->view('messages/reg_ok');
            } else {
                $data['disp_error'] = $user_reg['error'];
            }
        }
        
        $this->load->view('register_view', $data);
    }

What`s the problem?

El Forum

[eluser]wiredesignz[/eluser]
That can't be the controller causing the issue, line number 13 has no reference to $this->ezauth.

Other than that, the only trivial problem I see is the instruction to load the ezauth_model should be all lowercase.

El Forum

[eluser]v33s[/eluser]
Thanks for a reply, but changing the EzAuth_Model to lowercase not resolve the problem, original example from ezAuth site have got it with uppercase...

El Forum

[eluser]Rick Jolly[/eluser]
Like wiredesignz mentioned, you're not showing the correct code. Maybe we could help if you show us the code that causes that error.

El Forum

[eluser]v33s[/eluser]
Have reference here:

Code:
.......

$user_reg = $this->ezauth->register($inp);
            if ($user_reg['reg_ok'] == 'yes') {
                $v_code = $user_reg['code'];

......

It must be that controller Wink

El Forum

[eluser]Rick Jolly[/eluser]
Nope, that's not the code according to your error. Line 13 of your register controller has a call to authorize(). Post the controller with that code.

El Forum

[eluser]v33s[/eluser]
Function authorize() is in my model ;o

If i put localhost/codeigniter/register

My controller register.php:
http://phpfi.com/317148

And model ezAuth:
http://phpfi.com/317150

El Forum

[eluser]Rick Jolly[/eluser]
Ah, it's a simple spelling mistake:
Code:
function __contruct()
// should be
function __construct()

El Forum

[eluser]v33s[/eluser]
OMG Smile I do not saw it ;( But thanks Wink

El Forum

[eluser]wiredesignz[/eluser]
Wow, I never saw it either. Rick gets the weekly `Eagle Eyes` prize. Smile