Jump to content

Display custom profile field as text


CGlobe

Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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