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.)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data