Best unofficial Apache Server developers community |
|
I already asked this question, but in a way that confused people. So what I want to achieve is this: I have a method get_user_by_email() and it is used to grab the row from the database table of a user who is logged out.
The above code doesn't work and I know this but I was giving an example of what I am doing with the data I get from the row. I just want to some how make this available to my reset_password controller through out, then my confirm_reset_code controller and then finally my create_new_password controller. How would I do this?
posted via StackOverflow
|
|
 
|
Add the function into a model , then you can load the model in different controllers when you need it . Please read the documentation . Example
Save this to application/models/user_model.php , then in any of you're controller you can call :
Then play with user data how you like |
|
 
|
You cannot return multiple times. Just make an array, and return that. Instead of This function should be inside a model file, which can be loaded from any controller. |
|
 
|
I just made a detailed blog post about this exact topic, covering how to construct your "protected" controllers and at the same time define a global I will try to compile a summary for this answer but until then, checkout my post. |
|
 
|
Hands down the easiest way would be to store that information in a cookie/session. Typically I store the users email, name, and user_id. I of course encrypt the information stored in the cookie/session as well :) |