CarlosEduardo2409 Posted June 3, 2018 Report Share Posted June 3, 2018 Hello everyone, I would like to know how to check if a specific user is online. Example: Check if user ID "ELC0003" is online. Thanks. Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted June 11, 2018 Report Share Posted June 11, 2018 <?php $allusers = StatsData::UsersOnline(); foreach ( $allusers as $user) { echo $user->firstname.'<br>; } ?> This is just a simple code, I guess this should help. Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted June 11, 2018 Author Report Share Posted June 11, 2018 31 minutes ago, LeonardIGO4036 said: <?php $allusers = StatsData::UsersOnline(); foreach ( $allusers as $user) { echo $user->firstname.'<br>; } ?> This is just a simple code, I guess this should help. Thank you very much @LeonardIGO4036, but I would like to know one specific pilot. So, I'm customizing Airmail for ElaSkin, and it will tell me if the user of the message is online. So from what I'm thinking I would have to get the ID of this pilot and continue, but I have no idea how. Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted June 12, 2018 Report Share Posted June 12, 2018 23 hours ago, CarlosEduardo2409 said: Thank you very much @LeonardIGO4036, but I would like to know one specific pilot. So, I'm customizing Airmail for ElaSkin, and it will tell me if the user of the message is online. So from what I'm thinking I would have to get the ID of this pilot and continue, but I have no idea how. Okay, now i understood. You just need to amend this code with an extra conditional statement. <?php $allusers = StatsData::UsersOnline(); $pilotid = (assign it here); foreach ( $allusers as $user) { if($user->pilotid == $pilotid) { echo 'Online'; } else { echo 'Offline'; } } ?> That should be it! 1 Quote Link to comment Share on other sites More sharing options...
CarlosEduardo2409 Posted June 12, 2018 Author Report Share Posted June 12, 2018 6 minutes ago, LeonardIGO4036 said: Okay, now i understood. You just need to amend this code with an extra conditional statement. <?php $allusers = StatsData::UsersOnline(); $pilotid = (assign it here); foreach ( $allusers as $user) { if($user->pilotid == $pilotid) { echo 'Online'; } else { echo 'Offline'; } } ?> That should be it! Amazing! Thank you so much!! Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted June 12, 2018 Report Share Posted June 12, 2018 1 minute ago, CarlosEduardo2409 said: Amazing! Thank you so much!! You're welcome mate. All the best! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.