Help displaying Vatsim IDs

It’s showing on the users profile just not the list. I tried to manually add my vatsim id in phpmyadmin using 7,7,2, 855360 still didn’t display anything on the pilot list, but in my profile it showed my vatsim id 2 times.

Hmm that’s weird.

Can you pastebin the entire template?

VATSIM ID is how it is in the field, I changed it from Vatsim ID to VATSIM ID

<h3><?php echo $title?></h3>

<?php
if(!$allpilots)
{
	echo 'There are no pilots!';
	return;
}
?>

<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Pilot ID</th>
<th>Name</th>
<th>Rank</th>
<th>Flights</th>
<th>Hours</th>
    <th>Vatsim ID</th>
</tr>
</thead>
<tbody>
<?php
foreach($allpilots as $pilot)
{
/* 
	To include a custom field, use the following example:

	<td>
		<?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?>
	</td>

	For instance, if you added a field called "IVAO Callsign":

		echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign');		
 */
?>
<tr>
<td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>">
		<?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a>
</td>
<td>
	<img src="<?php echo Countries::getCountryImage($pilot->location);?>" 
		alt="<?php echo Countries::getCountryName($pilot->location);?>" />

	<?php echo $pilot->firstname.' '.$pilot->lastname?>
</td>
<td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
<td><?php echo $pilot->totalflights?></td>
<td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td>
    <td><?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?></td>
<?php
}
?>
</tbody>
</table>

After this:

echo PilotData::GetFieldValue($pilot->pilotid, ‘VATSIM ID’);

Can you put (just right after it, before the ?>:

DB::debug();

And refresh the page with the output

I have also put the field same way, and also nothing…

I put IVAO id inside ADMIN panel, and i have it on my pilots profile, but in pilot list only table IVAO id, nothing under…cant get the number i guess…how can i fix that?

Guys finally got it…just put one field in pilots database, in my example IVAO…Add that field also in admin panel…and add like in previous pilot_list.php everything only line in below shpuld look like this

<td><?php echo $pilot->IVAO?></td>

I have no knowledge of coding but after 2 hours trying, it was worth it

I hope this helps somebody hehe…

Hi all,
I am trying to show cutom filed in Pending PIREPS,
using the following code, any help in foreach code ?
I got one issue where to put this and correct way to add it :
 

<?php
foreach($pilot_list as $pilot)
{

 

?>

<?php
}
?>
Because in pending PIREPs i call for : foreach ( pireps as pirep !

Thank you
 

\<tbody\> \<?php foreach($pireps as $pirep) { if($pirep-\>accepted == PIREP\_PENDING) $td\_class = 'pending'; else $td\_class = ''; $error = false; ?\> \<tr class="\<?php echo $class?\> pirep\_list" id="row\<?php echo $pirep-\>pirepid;?\>"\> \<td align="center" valign="top" nowrap="nowrap" style="width: 27px;" class="\<?php echo $td\_class;?\>"\> \<img height="25px" width="25px" src="\<?php echo PilotData::GetPilotAvatar($pirep-\>pilotid);?\>" align="left" /\> \</td\> \<td align="left" valign="top" nowrap class="\<?php echo $td\_class;?\>"\> \<strong\>\<a href="\<?php echo SITE\_URL?\>/admin/index.php/pilotadmin/viewpilots?action=viewoptions&pilotid=\<?php echo $pirep-\>pilotid;?\>"\> \<?php echo PilotData::GetPilotCode($pirep-\>pcode, $pirep-\>pilotid) . ' - ' .$pirep-\>firstname .' ' . $pirep-\>lastname;?\>\</a\> \<!-- Here i would like to show VATSIM or IVAO ID using the following code --\> l \<?php echo PilotData::GetFieldValue($pilot-\>pilotid, 'VATSIM CID or IVAO VID'); ?\> \</strong\> \<strong\>Flight:\</strong\> \<?php echo $pirep-\>code . $pirep-\>flightnum; ?\>\</div\> \<strong\>Dep/Arr: \</strong\>\<?php echo $pirep-\>depicao; ?\>/\<?php echo $pirep-\>arricao; ?\> \<strong\>Flight Time: \</strong\>\<?php echo $pirep-\>flighttime; ?\> \<br /\> \<strong\>Submit Date: \</strong\>\<?php echo date(DATE\_FORMAT, $pirep-\>submitdate); ?\> \<strong\>Current Status: \</strong\> \<?php echo PilotData::GetFieldValue($pilot-\>pilotid, 'VATSIM CID or IVAO VID');?\> \<?php if($pirep-\>accepted == PIREP\_ACCEPTED) echo 'Accepted'; elseif($pirep-\>accepted == PIREP\_REJECTED) echo 'Rejected'; elseif($pirep-\>accepted == PIREP\_PENDING) echo 'Approval Pending'; ?\> \<?php # If there was an error, don't allow the PIREP to go through if($pirep-\>aircraft == '') { $error = true; } ?\> \<table width="100%" style="border: none;"\>

 

Have you tried this?

\<?php echo PilotData::GetFieldValue($pirep-\>pilotid, 'VATSIM CID'); ?\>

 

Yes it is already in the code

40 minutes ago, FlyingMachine said:

Yes it is already in the code

Are you sure you tried that exact line? Note the difference between $pilot and $pirep.

Doesn’t it need a 

foreach $pilots as $pilot

in there somewhere to be able to get  $pilot->pilotid  from the pilots database table? pilots table being plural and pilot being singular…


Is the VATSIM ID stored in the pilots database table?

Or did you add the VATSIM ID as a Custom Field? If Custom Field , the data (VATSIM ID) is stored in the fieldvalues table.

Then call it as

\<?php echo PilotData::GetFieldValue($pilot-\>pilotid, 'VATSIM ID'); ?\>

If the field is named different than ‘VATSIM ID’, change that in the code above.

Dears,

I have the code of custom field on Pilot list page, works perfect, i would like to show the same filed on pending pireps, next to full name check my code.

The problem is in that template forache requests : foreach($pireps as $pirep) i would like to add pilots as pilot here.

To display the custom filed.

Yours,

11 hours ago, ProAvia said:

Doesn’t it need a 

foreach $pilots as $pilot

in there somewhere to be able to get  $pilot->pilotid  from the pilots database table? pilots table being plural and pilot being singular…

As long as you pass in a pilot id as the first parameter of PilotData::GetFieldValue() it shouldn’t matter where you put it or if you use it in a loop.

 

1 hour ago, FlyingMachine said:

I have the code of custom field on Pilot list page, works perfect, i would like to show the same filed on pending pireps, next to full name check my code.

 

1 hour ago, FlyingMachine said:

To display the custom filed.

 

I have checked your code, you have provided this:

\<!-- Here i would like to show VATSIM or IVAO ID using the following code --\> l \<?php echo PilotData::GetFieldValue($pilot-\>pilotid, 'VATSIM CID or IVAO VID'); ?\>

As I stated above, if you want it to work inside of your pireps page ($pireps loop as you provided) then you will need to swap that line for this one (as I already provided above):

\<?php echo PilotData::GetFieldValue($pirep-\>pilotid, 'VATSIM CID'); ?\>

where VATSIM CID is the name of your custom field. Note the change from $pilot to $pirep. If this isn’t what you are after then please give further explanation/code so we can help you out.

1 Like

Thank you web541. Works perfect!

Yours,