I am developing an application in CodeIgniter and MySQL. The application includes user profiles; I use Tank Auth to register and authenticate users.
I installed a couple of users and now I want to view each user profile. I need to know:
1 - How to add user session data to Tank Auth . I have an idea of ββwhat the code should look like (http://codeigniter.com/user_guide/libraries/sessions.html), but I'm not sure where the code should go in the auth controller, which is quite extensive - https: // github.com/ilkon/Tank-Auth/blob/master/application/controllers/auth.php .
2 - How to transfer user data to a view . I set up a function to extract user data (see below) and I want to transfer it to my profile - I think that userdata (in code) will represent user session data, which will include the user ID and username, one of which I will need to URL
3 - URL . I want the urls to look like this: http://example.com/users/3394 or http://example.com/users/fooy_foo . I know that I need to do something with the CI URI routing, but I'm not sure how to relate it to the results that I get from the request.
Here is the code from the user controller {
function index() { $id = $this->tank_auth->is_logged_in('id'); $this->db->where('id', $id); $q = $this->db->get('user'); $data['userdata']=$q; $this->load->view('user_view', $data); } }
source share