I want to regenerate my cookie's name after every successfull login ( I regenerate already my Session Id).

When I try to regenerate my cookie's name, joomla lost my session! ( in JSession class)

Do you know the best joomla's practise for regenerate the cookie's name?

It's my code, for get different cookie's name on every Session :

// It's on Joomla\Session\Session.php
    if (isset($options['name']))
        $date = new DateTime();
        $timestamp =  $date->getTimestamp();
        session_name(md5($options['name'] . $timestamp));

The instance of the JSession is a singleton, Is it for that I just add a dynamic timestamp when the instance is create, that generate a different name for every first instance of the JSession (No?) .

Thanks you!

  • You may store that generated cookie name in some variable and make JSession get the name from that variable..
    – faissl
    Commented Nov 26, 2015 at 11:21
  • Just a dumb question. Why do you want to change the cookie? Commented Jun 10, 2017 at 23:58

1 Answer 1


In joomla we had the Joomla Registration and login plugins and modules.

if you can use it. it automatically generate the cookies also.

use it. then you can get the good result.

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.