orobouros Posted October 2, 2016 Report Posted October 2, 2016 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 ? Quote
Members Vangelis Posted October 2, 2016 Members Report Posted October 2, 2016 what is your website link ? Quote
orobouros Posted October 2, 2016 Author Report Posted October 2, 2016 Here is our brand new website : http://www.arcadair.fr Quote
Members Vangelis Posted October 3, 2016 Members Report Posted October 3, 2016 how do you know who is staff ? By rank ? by id ? Quote
orobouros Posted October 3, 2016 Author Report Posted October 3, 2016 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 ? Quote
Jon Posted October 3, 2016 Report Posted October 3, 2016 (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 October 3, 2016 by Jon Quote
orobouros Posted October 3, 2016 Author Report Posted October 3, 2016 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. Quote
Jon Posted October 3, 2016 Report Posted October 3, 2016 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> Quote
orobouros Posted October 3, 2016 Author Report Posted October 3, 2016 Excellent ! A big thank you for this solution, it works ! 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.