This works great for 3.4 Joomla. How do I keep the user logged in? i.e. "remember"?

$options = array();
$options['action'] = 'core.login.site';
$response->username = "user_name_here";
$result = $app->triggerEvent('onUserLogin', array((array)$response, $options));

$options['remember'] = TRUE doesn't seem to work. Does anyone know if this particular API call supports a remember me option. Users stay logged in but are immediately logged out when the browser window is closed.


i was able to get remember me working by following tips at this site to fix session.cookie lifetime on the server settings: http://forum.joomla.org/viewtopic.php?f=470&t=457307&start=30

added following to index.php in joomla - hopefully helps others out.

ini_set('session.cookie_lifetime', 536*60*60);

  • 3
    Please add the solution as an answer and accept it! Commented Jan 22, 2016 at 2:22
  • You've found your workaround, however note that API should be stateless, and should not involve sessions.
    – Alexandr
    Commented Mar 30, 2018 at 7:37

1 Answer 1


This worked for me last time I did that.

// login the new user
$app = JFactory::getApplication();
$options = array(
    'remember' => true,
    'return' => '',
$credentials = array(
    'username' => $user['username'],
    'password' => $user['password_clear'],
if ($app->login($credentials, $options)!==true) $this->close(false,'Could not login new user account.');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.