Forgot password function not working in CodeIgniter
Load user model in auth controller. You can load it in constructor or in the function.
class Auth extends CI_Controller{function __construct(){ parent::__construct(); $this->load->model('user_model'); // load user model}public function forgot(){// your code}
In Function
class Auth extends CI_Controller{ public function forgot(){ $this->load->model('user_model'); // load user model // your code }
Not tested
You need to make sure that the user_model class is loaded from the controller. Like so:
class Auth extends CI_Controller { function __construct() { $this->load->model('user_model'); }}
And be sure that you have the spelling/capitalization correct in the model class.
class User_Model extends CI_Model { // rest of code}
@frodo again.
First Error : in your controller code, you need to initialize model first than only you can use the model property.
public function forgot(){ // Changes required $this->load->model('user_model'); $userInfo = $this->user_model->getUserInfoByEmail($clean);}
Second Error :
if($userInfo->status != $this->status[1]){ $this->session->set_flashdata('flash_message', 'Your account is not in approved status'); redirect(site_url().'auth/login');}
How you get the value of $this->status[1]
variable. You can simply use if($userInfo->status != true)
.
Please change this code and let me know if you have any error.