I've created a hook_default_user_stats hook in order to provide additional user statistics within the framework of this module.

I've attached two files:

  • A .patch file demonstrating the change inside user_stats_get_stats()
  • A new user_stats.api.php file outlining how to use this new hook (I'm still fuzzy on creating a new file via patches)

Please take this functionality into consideration as it can be very helpful and adds minimal complexity, because the current caching system is very flexible already.

Thanks,
Erik

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Liam McDermott’s picture

Status: Needs review » Postponed (maintainer needs more info)

This patch looks great!. Do you think it would be too much of a performance hit to get rid of that monolithic switch case statement and make all statistics work this way?

Also, I'm going to make User Stats object oriented for Drupal 7 and am thinking this work will fit quite nicely with that. Does that make sense, or would there be a better way in light of that?

About new files:
You can use cvsdo to make CVS think new files are already in the repository. It only works on new files and not directories, or new files inside directories.

My workflow for adding new files looks like:

cvsdo add NEWFILE
cvs diff -upN > issue.patch
erikwebb’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.52 KB

Here's a re-rolled CVS patch with the proper add. I think removing the switch case statement would be cleaner, but I don't think it's as important as releasing the ability for others to add their own stats.

Honestly, I haven't jumped into D7 development much yet, so I can't comment on how to move this to OOP.

Liam McDermott’s picture

Status: Needs review » Fixed

Sorry for not committing this sooner, but hopefully I can make up for that by committing it now. :)

Great idea, good work by the way. Thank you very much.

Status: Fixed » Closed (fixed)

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