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 */

I think, it would be pretty easy for someone who would like to have such a feature.