Jump to content

Recommended Posts

Posted

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

Posted (edited)
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">&nbsp;<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).' " width="17" height="17"  />';

                                    

                                    echo '&nbsp;<Strong>'.$pilot->firstname.'</strong>  '.$pilot->lastname.'<br />';  

                                    echo '<small></small>';

                                    echo "</p>";

                                    }

                                    ?>

 

On the highlighted line I have problems

Edited by gio1961
Posted
<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>";
   }   
?>

 

Posted
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">&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>";
   }   
?>

 

Thank you.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...