Determine users who have not logged in <20> days

We have a requirement where we need to return the list of users who have not logged in the last 20 days from today().

Can anyone provide a sample code/approach how to do it?

Currently we are thinking of accessing the audit-log and storing in a table for the last 20 days and comparing with the application users and taking out the logged in users.

But this is a pretty long process. We also checked for below plugins.

1.User Loging Details (v1.0.0):Has a method -GetUserLastLogin, but this is returning data of audit-log for today().

2. Plugin: Login information parser almost does the same as we thought of approaching.

(The use case is to deactivate user after certain days of inactivity, there's a setting in the Admin console but we wanted to complete few things before deactivation.)

Parents
  • I have used the approach you describe to do achieve this. I do not know of any other option. The implementation I delivered:

    • reads the audit log
    • loads the data into a database table
    • checked each entry to see when a User last logged in
    • sent that user a warning email if they hadn't logged in for a certain period of time (and recorded the fact that we'd sent them an email so that we didn't keep sending them the same email)
    • if they didn't log in within 3 days of their warning email then the process deactivated their account

    (you hadn't said what your specific use case is but this is the most likely reason you want to check, to see if the licence can be freed up)

Reply
  • I have used the approach you describe to do achieve this. I do not know of any other option. The implementation I delivered:

    • reads the audit log
    • loads the data into a database table
    • checked each entry to see when a User last logged in
    • sent that user a warning email if they hadn't logged in for a certain period of time (and recorded the fact that we'd sent them an email so that we didn't keep sending them the same email)
    • if they didn't log in within 3 days of their warning email then the process deactivated their account

    (you hadn't said what your specific use case is but this is the most likely reason you want to check, to see if the licence can be freed up)

Children

 Discussion posts and replies are publicly visible