Virtualei Posted March 4, 2013 Report Posted March 4, 2013 Hi everyone, I was wondering if anyone would be able to help me. On my site I have the normal pilots online,guests online. I would like to be able to show staff members online. has anyone any ideas. I have simpilots staff module so maybe i could use it in some way All help appreciated . Thanks in advance 1 Quote
Moderators Kyle Posted March 4, 2013 Moderators Report Posted March 4, 2013 I don't have the simpilot staff module though, but this can be little bit easier for everyone.... This code will only show staff online. <?php $staff = StatsData::UsersOnline(); foreach($staff as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN)) { ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br /> <?php } } ?> Quote
Virtualei Posted March 4, 2013 Author Report Posted March 4, 2013 Perfect Kyle . Works a treat. Thanks Quote
Virtualei Posted March 14, 2013 Author Report Posted March 14, 2013 One problem I have encountered. If a staff member is logged onto the site and Kacars his name appears twice on the website. How can i disable one of them. Thanks Quote
Moderators servetas Posted March 31, 2013 Moderators Report Posted March 31, 2013 If you had searched the forum, you would have found the solution without bumping the topic!! <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> Quote
Virtualei Posted March 31, 2013 Author Report Posted March 31, 2013 Can I ask where you found it as I did search Quote
Moderators servetas Posted March 31, 2013 Moderators Report Posted March 31, 2013 After a fast search using my 10.1" tablet, check out what i found. http://forum.phpvms.net/topic/7148-users-online/ and http://forum.phpvms.net/topic/4641-pilots-shown-twice-solved/page__hl__%2Busers+%2Bonline+%2Bonce Best regards! Quote
Virtualei Posted March 31, 2013 Author Report Posted March 31, 2013 Your code did help a little but wasn't quite correct. Thanks for the bit that did help. If you had searched the forum, you would have found the solution without bumping the topic!! Maybe if you had read the question correctly you would have realized what I was asking Here is the full code for anyone interested. Thank you <?php $shown = array(); $staff = StatsData::UsersOnline(); foreach($staff as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN)) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br /> <?php } } ?> Quote
Moderators servetas Posted April 1, 2013 Moderators Report Posted April 1, 2013 I gave you the base code in order to do it on your own as no one helped. Nevermind... Have a nice day! Quote
flyalaska Posted April 22, 2013 Report Posted April 22, 2013 BTW, IPB search function sucks. You get threads that have nothing to do with your search. Quote
gio1961 Posted July 23, 2013 Report Posted July 23, 2013 OK... <?php $shown = array(); $staff = StatsData::UsersOnline(); foreach($staff as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN)) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br /> <?php } } ?> How to insert a condition if ... "no staff online"? thanks for any response... Quote
simonecatalano Posted August 25, 2013 Report Posted August 25, 2013 IT's possible view the country? Thanks Quote
warpennys Posted November 14, 2013 Report Posted November 14, 2013 PILOTS ONLINE and STAFF ONLINE with avatar, country, and link to profile It was late, so the only thing to add in this code is to have the counts show '0' when there are no pilots to count for staff and pilots online. Know that an admin must have access to your admin panel in order to be included in the Staff Online side of the table. Also, the pic below is not accurate, but only the first attempt. The code posted has been fixed to show staff only on the left and pilots only on the right. Also, the only problem with the code is the counts. Guests are counted correctly, however when a pilot or staff member is online with kacars and flying a flight, they are counted again, so when it says there's 2 there is actually only 1. If anyone can find a fix or knows of a fix, this code would be 100%. Thank You. <table class="(to your favorite table style in your css)" border="0" align="center" width="100%" height="300"> <th colspan="1" align="center" class="(to your favorite th style in your css)">Pilots Online</th> <tr> <td> <table align="center" width="100%" style="text-align:center; background-color: #F1AD43; font-weight: bold; color: #000000; height: 10px;"> <tr> <td>STAFF ONLINE</td> <td>PILOTS ONLINE</td> </tr> </table> <table border="0" align="center" width="100%" height="150"> <tr> <!-- ==================================================VVVV STAFF ONLINE VVVV============================================== --> <td align="left" width="50%" style="padding-left: 100px;"> <div style="overflow-y: auto; overflow-x: hidden; height: 150px; background: transparent;"> <?php $shown = array(); $staff = StatsData::UsersOnline(); foreach($staff as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN) == true) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>" title="Visit Pilots Profile"><img style="padding-bottom: 2px; border: 1px; border-radius: 4px;" align="center" height="28px" width="28px" src="<?php echo PilotData::getPilotAvatar($pilot->pilotid);?>"/> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" title="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' - ' .$pilot->firstname . ' ' . $pilot->lastname?> </a><br /> <?php } } if(count($shown) < 1){ echo '<br /><br /><br /><h3><font color="#ff0000"><p style="padding-left: 50px;">No Staff Online</p></font></h3>'; } ?> </div> </td> <!-- ==================================================VVVV PILOTS ONLINE VVVV============================================== --> <td align="left" width="50%" style="padding-left: 100px;"> <div style="overflow-y: auto; overflow-x: hidden; height: 150px; background: transparent;"> <?php $shown = array(); $usersonline = StatsData::UsersOnline(); foreach($usersonline as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN) == false) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>" title="Visit Pilots Profile"><img style="padding-bottom: 2px; border: 1px; border-radius: 4px;" align="center" height="28px" width="28px" src="<?php echo PilotData::getPilotAvatar($pilot->pilotid);?>"/> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" title="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' - ' .$pilot->firstname . ' ' . $pilot->lastname?> </a><br /> <?php } } if(count($shown) < 1){ echo '<br /><br /><br /><h3><font color="#ff0000"><p style="padding-left: 50px;">No Pilots Online</p></font></h3>'; } ?> </div> </td> </tr> </table> </td> </tr> <tr> <td> <hr /> <?php $userCount = 0; $staffCount = 0; $guestsonline = count(StatsData::GuestsOnline()); $pilots = StatsData::UsersOnline(); foreach($pilots as $staff){ if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($staff->pilotid), ACCESS_ADMIN) == true) { $staffCount++; }else{ $userCount++; } } ?> <p align="center"> <b> <font color="#F1AD43">Staff Online:</font> <font color="#00FF00"><?php echo $staffCount; ?></font> <font color="#F1AD43">Pilots Online:</font> <font color="#00FF00"><?php echo $userCount; ?></font> <font color="#F1AD43">Guests Online:</font> <font color="#00FF00"><?php echo $guestsonline; ?></font> </b> </p> <br /> </td> </tr> </table> Quote
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.