How to Get a List of Users/Contributors Who Have Modified Content Recently

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

Sometimes it is useful for an administrator to find which users have created or edited content recently or on a specific date. This KB illustrates how to query the database via SQL to retrieve this information quickly.

Related KBs:

Solution

Users who have created or edited content since a specific date

The example SQL below retrieves all users who have created or edited content since May 1, 2016. The date can be modified as needed. Note that different databases may have different formats for the date field as well, which may require further tweaks.

  • On PostgreSQL:

    SELECT um.lower_username
    FROM user_mapping um
    JOIN CONTENT c
      ON um.user_key = c.lastmodifier
    WHERE c.lastmoddate >= '2016-05-01'
    GROUP BY um.lower_username;
  • On MS SQL:

    SELECT um.lower_username
    FROM user_mapping um
    JOIN CONTENT c
      ON um.user_key = c.LASTMODIFIER
    WHERE c.LASTMODDATE >= '2016-05-01'
    GROUP BY um.lower_username;
  • On Oracle:

    SELECT um.lower_username
    FROM user_mapping um
    JOIN CONTENT c
      ON um.user_key = c.lastmodifier
    WHERE c.lastmoddate >= '01-Jan-2016'
    GROUP BY um.lower_username;

The last modification/creation of pages, blog posts, or comments

The SQL query below will provide you a list of those users separated by spaces (space keys starting with ~ are referring to personal spaces).

  • On PostgreSQL or MS SQL:

    SELECT s.SPACEKEY,s.SPACENAME,u.username, MAX(c.LASTMODDATE) AS lastabsolutemoddate
    FROM CONTENT c
    JOIN user_mapping u ON u.user_key=c.LASTMODIFIER
    JOIN SPACES s ON s.SPACEID = c.SPACEID
    WHERE c.CONTENTTYPE !='USERINFO'
      AND c.LASTMODIFIER IS NOT NULL
      AND c.SPACEID IS NOT NULL
    GROUP BY s.SPACEKEY,s.SPACENAME,u.username
    ORDER BY s.SPACEKEY,u.username;


Last modified on Sep 10, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.