Privacy

Hi guys, for privacy reasons, I have to display only the name of the pilot and the first character of the last name, how can I edit this code?

<?php echo $pilot->firstname.’ '.$pilot->lastname?>

Grace for a possible response

Try this

<?php echo $pilot->firstname .’ '. substr ($pilot->lastname, 0, 1)?>

https://www.w3schools.com/php7/func_string_substr.asp

I’ve done the same everywhere on the user/public side of my site. On the admin side, I still show complete last name.

1 Like

10 hours ago, ProAvia said:

Try this

<?php echo $pilot->firstname .’ '. substr ($pilot->lastname, 0, 1)?>

https://www.w3schools.com/php7/func_string_substr.asp

I’ve done the same everywhere on the user/public side of my site. On the admin side, I still show complete last name.

Thank you. Very kind

 <?php

                              $usersonline = StatsData::UsersOnline();

                              $guestsonline = StatsData::GuestsOnline();

                            ?>

                                <h5><?php      

                                    $shown = array();

                                    foreach($usersonline as $pilot)

                                    {

                                    if(in_array($pilot->pilotid, $shown))

                                    continue;

                                    else

                                    $shown = $pilot->pilotid;

                                    echo β€œ<p>”;

                                    

                                    echo β€˜<img src=β€œ/en/lib/skins/crewcenter/images/pilot.png” class=β€œimg-circle” alt=β€œUser Image” height=β€œ20”> <img src="’.Countries::getCountryImage($pilot->location).β€˜" alt="’.Countries::getCountryName($pilot->location).’ " width=β€œ17” height=β€œ17”  />';

                                    

                                    echo ’ <Strong>β€˜.$pilot->firstname.’</strong>  β€˜.$pilot->lastname.’<br />';  

                                    echo β€˜<small></small>’;

                                    echo β€œ</p>”;

                                    }

                                    ?>

 

On the highlighted line I have problems

\<h5\> \<?php $usersonline = StatsData::UsersOnline(); $guestsonline = StatsData::GuestsOnline(); $shown = array(); foreach($usersonline as $pilot) { if(in\_array($pilot-\>pilotid, $shown)) continue; else $shown[] = $pilot-\>pilotid; echo "\<p\>"; echo '\<img src="/en/lib/skins/crewcenter/images/pilot.png" class="img-circle" alt="User Image" height="20"\>&nbsp;\<img src="'.Countries::getCountryImage($pilot-\>location).'" alt="'.Countries::getCountryName($pilot-\>location).' " width="17" height="17" /\>'; echo '&nbsp;\<strong\>'.$pilot-\>firstname.'\</strong\> '.substr($pilot-\>lastname, 0, 1).'\<br /\>'; echo '\<small\>\</small\>'; echo "\</p\>"; } ?\>

 

5 minutes ago, PaintSplasher said:

<h5> <?php $usersonline = StatsData::UsersOnline(); $guestsonline = StatsData::GuestsOnline(); $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown = $pilot->pilotid; echo β€œ<p>”; echo β€˜<img src=β€œ/en/lib/skins/crewcenter/images/pilot.png” class=β€œimg-circle” alt=β€œUser Image” height=β€œ20”> <img src="’.Countries::getCountryImage($pilot->location).β€˜" alt="’.Countries::getCountryName($pilot->location).’ " width=β€œ17” height=β€œ17” />β€˜; echo ’ <strong>’.$pilot->firstname.β€˜</strong> β€˜.substr($pilot->lastname, 0, 1).’<br />’; echo β€˜<small></small>’; echo β€œ</p>”; } ?>

 

Thank you.