Manually login a member in ExpressionEngine
Posted on April 9, 2013
In ExpressionEngine, sometime it may needed to login a member manually not from the login area by having the username / password. All the member’s sessions are being created and managed with Session Class. We can use the same session class to login a member manually.
Here is the code:
$this->EE =& get_instance(); /* Setting garbage collection probability to 100% */ $this->EE->session->gc_probability = 100; /* Delete old session */ $this->EE->session->delete_old_sessions(); $this->EE->session->create_new_session($member_id); $this->EE->session->fetch_session_data(); $this->EE->session->fetch_member_data();
I think, it would be pretty easy for someone who would like to have such a feature.