web541 Posted May 29, 2020 Report Posted May 29, 2020 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. Quote
Administrators ProAvia Posted May 29, 2020 Administrators Report Posted May 29, 2020 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. Quote
FlyingMachine Posted May 29, 2020 Report Posted May 29, 2020 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, Quote
web541 Posted May 29, 2020 Report Posted May 29, 2020 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 Quote
FlyingMachine Posted May 30, 2020 Report Posted May 30, 2020 Thank you web541. Works perfect! Yours, 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.