Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter

[eluser]NotSmilie[/eluser]
Thanks for the help Smile
I'm still struggling though, I attempted to update a user, and it didn't work at all, lol.
Here is my function

Code:
function edit(){
        $user_id = mysql_real_escape_string($product_id = $this->uri->segment(3));
        $user = $this->flexi_auth->get_user_by_id_row_array($user_id);
        if($user == false){
            $data['error'] = "User doesn't exists";
            $data['page'] = 'user';
            $data['query'] = $this->db
                ->get('user_accounts');
            $view = $this->load->view('user/userlist', $data, TRUE);
            $this->template->create_page('User', $view);
        }
        $data['user'] = $user;
        $data['page'] = 'user';
        $data['query'] = $this->db
            ->get('user_groups');

        if(!empty($_POST)){
            if($_POST['uacc_password'] != '')
                $user_data = array(
                    'email' => $_POST['uacc_email'],
                    'password' => $_POST['uacc_password'],
                    'username' => $_POST['uacc_username'],
                    'group_fk' => $_POST['uacc_group_fk'],
                    'uacc_credits' => $_POST['uacc_credits']
                );
            else
                $user_data = array(
                    'uacc_email' => $_POST['uacc_email'],
                    'uacc_username' => $_POST['uacc_username'],
                    'uacc_group_fk' => $_POST['uacc_group_fk'],
                    'uacc_credits' => $_POST['uacc_credits']
                );

            $data['res'] = $this->flexi_auth->update_user($user_id, $user_data);
            $data['message'] = $this->flexi_auth->get_messages();
        }

        $view = $this->load->view('user/edit', $data, TRUE);
        $this->template->create_page('User', $view);
    }

I wasn't really sure if the fields were supposed to have uacc_ before them, they don't have that in the online documentation, and in the example, they had upro_ so I tried with both without help though.


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 03-08-2013, 03:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB