Jump to content

Recommended Posts

Posted

Firstly, I'd like to start by saying my coding knowledge is non-existent, but I'd very much like to learn!

How would I go about displaying a custom profile field, which is just text, on another page?

Any help with code snippets or links to the right section of the documentation would be really helpful! :)

Thanks!

  • Like 1
Posted

If you want it on your Pilot Roster, try this

<?php
$fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'FIELDNAMEHERE');
?>

If you want it in your Profile Page, try this

<?php
$fieldvalue = PilotData::GetFieldValue($userinfo->pilotid, 'FIELDNAMEHERE');
?>

Posted

Ok, it's for the profile page, so trying this:

<li><strong>Station Callsign:</strong> <?php $fieldvalue = PilotData::GetFieldValue($userinfo->pilotid, 'STATION_CALLSIGN'); ?></li>

It's not showing anything on the frontend though? :(

Posted

This is what I've got, is this right? Still nothing showing :(

<?php
$fieldvalue = PilotData::GetFieldValue($userinfo->pilotid, 'STATION_CALLSIGN');
?>
<ul style="margin-top: 0px;">
<li><strong>Identification Number:</strong> <?php echo $pilotcode; ?></li>
<li><strong>Station Callsign:</strong> <?php echo $fieldvalue; ?></li>
<li><strong>Total Flights: </strong><?php echo $userinfo->totalflights?></li>
<li><strong>Total Hours: </strong><?php echo $userinfo->totalhours; ?></li>
</ul>

This is all going in profile_main.tpl if that helps?

Posted

Yep, it's a text field that says BZN01. Of the three accounts I have (mine and two for testing), only one account - the one I'm logged in with - has data, does that matter?

Posted

If you go to your admin panel, then to site & settings then to profile fields and select Show In User Profile.

If you don't have the code for that, then verify that you've spelt the field correctly and put this

<?php
$fieldvalue1 = PilotData::GetFieldValue($userinfo->pilotid, 'STATION_CALLSIGN');
?> <?php echo $fieldvalue1; ?>

Because the above code works for me. And in regards to your last question, as long as you have got information for the user you are logged in as, it will show.

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