Jump to content

Recommended Posts

Posted

Hello,

i would like to change the color of the callsign of the staff members in the pilots list. How can i do that ? (example : Turn staff callsign color in red instead of normal pilot color wich is blue in my case). I've search on the forum without success.

Anyone has a solution ?

Posted

We only know this by reading the staff page, and i want change the color in pilots list to highlight the staff members. It is just configured in backend, by adding a pilot in the administrator group. Did i missed something in the admin panel, any option ?

Posted (edited)

You'd want to use the PilotData::getPilotGroups(); function, which returns all the groups they're a member of, and you can change the font colour using an if statement then.

Something like:

<?php
$groups = PilotData::getPilotGroups($pilot->piloted);
if(in_array("group name",$groups){
//They are an admin
?>
<font color="red"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></font>
<?php
}
else {
echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname;
}
?>

Edited by Jon
Posted

I've tried to adapt this solution to my case, but without success.

This the code to replace, but i don't know how :

<td width="1%" nowrap><center><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
  <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a></center>
</td>

The name of the group is "administrators" in the database.

I'm not very good in php syntax. I understand your solution, but i've tried some solutions and it gives me all the time different syntax errors.

Posted

I think this is what you wanted, it's very rough solution, but I've got it working

<td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
  <?php
  $groups = PilotData::getPilotGroups($pilot->pilotid);
  $admin = false;
  $end  = "";
  foreach($groups as $group){
   if($group->name == "Administrators"){
 $admin = true;
 break;
   }
  }
  if($admin){
   echo "<font color='red'>";
   $end = "</font>";
  }
  echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid).$end?></a>
</td>

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...