forwarding this to the list for
archives, this could be interesting to others.
regards,
S.B.
-------- Message original --------
Le 18/01/2013 09:38, 3072019751@linuxmail.org a écrit :
>>> How to submit a request for a "time of previous login session"/"ip of previous login session" feature?
>> hi,
>>
>> Maybe you can have a look at to the following request :
>> http://trac.roundcube.net/ticket/1488847
>>
>> and this plugin that can display the previous login time :
>> https://github.com/sblaisot/roundcube-topline
> Thanks a lot,
> just a detail, would it work for rc0.7.3?
Well, this plugin can't work with rc0.7.3 for two reasons :
* It has been designed for larry skin only at the moment, which is only
available starting from rc 0.8
* It needs some containers that are only present in the larry skin
starting from rc 0.9-beta
but the logic behind it for getting the time of previous session login
and storing it in the user session should be applicable.
in short :
1) register to login_after hook in the initialization of your plugin
$this->add_hook('login_after', array($this, 'store_lastlogin'));
2) store previous login time in user session on login
public function store_lastlogin($p)
{
$rcmail = rcmail::get_instance();
$user = $rcmail->user;
$_SESSION['lastlogin'] = $user->data['last_login'];
return $p;
}
3) use stored data for whatever you want
$my_wonderful_variable = $_SESSION['lastlogin'];
regards,
S.B.