In addition to counting the number of posts, it would be nice to count the number of logins. I am thinking that the sample module code in the Pro Drupal Development book might be good to integrate here.

CommentFileSizeAuthor
#4 user_stats_view.png21.03 KBcapellic
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Liam McDermott’s picture

Agreed, I'd like to include this too (am suprised I haven't raised a feature request myself actually!)

Liam McDermott’s picture

Status: Active » Postponed (maintainer needs more info)

I've committed an attempt at this. It should be available in the next dev release (happens automatically every day). Give it a test, if this works alright I'll create a Beta 2.

There's no way (that I know of) to retrospectively get a login count, so user_stats just starts counting from when it's installed. If there is a way, let me know. Am afraid I don't have that book you refer to. :)

capellic’s picture

EXCELLENT! I'll definitely test this out!

Here's the book: http://www.drupalbook.com

The script in the book can't retroactively count either. Every time someone logs in, a row is written to a table with the user ID and a time stamp. Then you simply do counts on the the rows for a given user ID. The timestamps can come in handy for other views, including trend analysis.

capellic’s picture

FileSize
21.03 KB

I upgraded and everything seems to be working fine. I did have trouble upgrading the module - Drupal kept on showing me the old settings page for user_stats and I don't know why. I finally got the new version to work, but don't know if it was the fact that I closed/opened the browser or cleared the cache or what.

You might want to change "Login count" to "Login Count" to remain consistent in your field naming scheme.

I added the Login Count field to my view. It's attached.

You've saved me some time, do you have a PayPal link?

Liam McDermott’s picture

Every time someone logs in, a row is written to a table with the user ID and a time stamp.

That's an excellent idea. This module is nowhere near as elegant. Thanks for the suggestion, I'll be using it in the next major version.

Drupal kept on showing me the old settings page for user_stats and I don't know why.

Oooh, think that might be a bug. Easy to fix though, I'll get onto that. :)

You've saved me some time, do you have a PayPal link?

My Paypal e-mail address is payments@intermedia-online.com (is that what you mean?) any donation would be welcome. Glad to hear this module's helping you! :)

Liam McDermott’s picture

Status: Postponed (maintainer needs more info) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

hmdnawaz’s picture

Every time someone logs in, a row is written to a table with the user ID and a time stamp.

I want to know the table name where user ID and a time stamp is written when some one logins?

nimishasharad’s picture

Version: 5.x-1.0-beta » 6.x-1.0-rc1

'users' is the table which maintains the user ID and time stamp. Time stamp is maintained in 'login' field. But its not like every time a user logs in a row is written in the table. First entry is made when user registers. Later only 'login' field is updated whenever user logs in. So this field contains the last log in time stamp.

On the other hand if you are using 'User Stats' module, 'user_stats_ips' table contains fields: 'uid' and 'first_seen_timestamp'. Row is entered only once in this table when the module encounters a user for the first time. Later in 'user_stats_values' table the 'count' field is incremented showing the number of time a user logged in.

nimishasharad’s picture

This is a contributed module that I have created. It generates reports showing user login trends yearly, quarterly and monthly.
This may help you..
http://drupal.org/node/1058594