last_seen variable is added to API UsersManager/API::getUsers if it exists.
I'm a bit worried about performance and wondering if we could rather have a new API for that? We have a couple of usages even within Piwik where we call
UsersManager.getUsers. We would ideally test it with eg 30K users (as some Piwik installations do have that many users). The option seems to be autoloaded so it will likely not trigger DB query for each user but still good to check before we regress there
This PR may need to be re-worked now. There's a method in UsersManager\API to add last_seen to multiple users: enrichUsersWithLastSeen. Used in a new API method.