Welcome Guest, Not a member yet? Register   Sign In
Ideal way for user information storing in cms and working with it
#2

[eluser]Samus[/eluser]
Yeah.

I had to do this several times.

I simply created a model which looked a little like this.

Code:
class User extends CI_Model {

function id_to_name($id) {
$query = $this->db->get_where('user_table', array('id' => $id));
$q = $query->row();
return $q->username;
}

}

Now all you have to do is call it in your controller.

Code:
$username = $this->user->id_to_user($this->session->userdata('id'));

That's a bland example, you can do whatever checks you want to ensure the user id exists, but it won't be necessary if your authentication is setup right.


Messages In This Thread
Ideal way for user information storing in cms and working with it - by El Forum - 04-14-2012, 05:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB