WordPress doesn't track if a user is online. It can only know if the current is online, which is always yes ( else there would be no request ). If you want to know if a different user that isn't the current user is online, that information doesn't exist, and you'll need to implement it yourself.
is_user_logged_in checks if the current user is authenticated aka logged in, it's not a test if a user is online
In order to do this you're also going to have to make compromises, and realtime online or not status tracking is not something you can do solely within WordPress.
Your options include:
- Updating a timestamp every time you access a page in user meta, then using that timestamp as a test ( aka if a users timestamp is within the last 5 minutes consider them online ), have an AJAX call ping your site to refresh the timer. Note that if the user closes their browser just after loading a page, they'll still show online for 5 minutes, and there's a performance cost to doing this, it will not scale with traffic
- Having a flag that indicates a user is online, and setting it to true when a user hits any page. Have a cron job that sets all flags to false at regular intervals. This will be cheaper to query on, but it's more expensive to run. You can make it less expensive by increasing the time delay of cron jobs, thus reducing accuracy. This still makes logged in users more expensive as every page load includes a database write. It will not scale with traffic.
Overall, what you're asking for is non-trivial, and while sounding simple, will either be very performance heavy, inaccurate, or require an additional server and development time. There is a trade off.
Will this change in the future? No, WordPress doesn't handle this kind of functionality or store this kind of data. WordPress does track sessions in user meta, but this is not the kind of data you are looking for. This may indicate how many devices a user has logged in on, but it's by no means reliable, and it can't be used to give an online or offline indicator