Search code examples
drupaldrupal-7drupal-modules

Track user's action


In our company I have to extend the functionality of existing Drupal 7 website. Here are the requirements:

  • The business needs to inform all staff members, on different topics using uploaded to the Drupal site documents. (I already implemented this requirement.)
  • The business needs to know, which staff members have read a document and which still have not. They need a report like this:

    Document 1 25/50 (25 from 50 staff members still didn't read the file)

    Document 2 50/50 (all staff members did read the file), etc.

In order to fulfill the second business requirement, I need a module which can track specific user's activity (in my case click on a link to download a file, which means the file is read). The module(s) have to be able to create a report like the one above. (All staff members have a drupal account with a specific role.)

Is there any drupal module I can use or maybe a part of it. Or the requirements are too 'custom' and I have to create my own module.


Solution

  • I created almost exactly the feature you need. I would be glad to help you in the process.

    I developed indeed a full custom module. And I could tell you that you will need different things:

    • A custom table in your DB to store the data
    • A custom entity called "track" or "action" that will be stored in the DB
    • Implementing the right hooks to create a track when you want to keep a track of a user's action
    • A custom page or block to display the tracks you stored in your DB with a custom query and appropriated permissions

    To achieve all that, I suggest you to take a look at these pieces of documentation:

    Hope it will help.