[eluser]Michael Wales[/eluser]
That looks pretty good flo - one thing I would look out for is the following line in your code:
Code:
if($this->data->user == true) {
I'm pretty sure PHP will evaluate this as you expect but logically it's an invalid statement.
$this->data->user will either be an object, containing user information (if that user exists) or FALSE. So, to be absolutely correct within your code (and avoid any obscure PHP screw-ups), test for FALSE.
Use the code below:
Code:
function index() {
// Test for an explicit FALSE (not 0, not unset, only FALSE)
if ($this->data->user !== FALSE) {
// We've added first_name and last_name columns to the users table, and since we have a user
// that data is now in the $this->data->user object. Let's get their full name so we can show
// it to them.
$this->data->display_name = $this->data->user->first_name . ' ' . $this->data->user->last_name;
}
// Pass the data object to the view
$this->load->view('welcome_message', $this->data);
return;
}