Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-03 16:57:04

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Can I keep a log of users last log in?

On a site of mine that uses ign_password_protect, I’d like to see when people have last logged in. I’m aware that I can see the last month they’ve logged in on the users tab, but I’d like to at least see the day as well. If there was a way of keeping a log that would be even nicer.

Is there any plugin that accomplishes this? I’m starting out to code PHP/MySQL, so if it would be a simple thing to do pointers on how to achieve this would be welcomed too…


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#2 2009-03-07 21:56:47

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Can I keep a log of users last log in?

anyone?


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#3 2009-03-07 23:41:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Can I keep a log of users last log in?

I don’t know of a plugin but here are some pointers: in the txp_users field of the database, there’s a field called last_access which is of type datetime. You can use the php function strftime (or rather txp’s in-built safe_strftime) to render the timestamp in whatever format you want by specifying the string format as shown on the strftime page.

This means you should be able to do something like this:

<p>Last logged in on <txp:php>global $txp_user; echo safe_strftime('%e %B %Y at %l:%M %p', $txp_user['last_access']);</txp:php></p>

to get Last logged in on 8 March 2009 at 12:39 am.

Maybe that helps. Note that if you are using the ign-own user table and not txp_users (set in the prefs), you need to target that database field instead.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB