CGlobe Posted December 5, 2015 Report Share Posted December 5, 2015 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! 1 Quote Link to comment Share on other sites More sharing options...
web541 Posted December 5, 2015 Report Share Posted December 5, 2015 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'); ?> Quote Link to comment Share on other sites More sharing options...
CGlobe Posted December 5, 2015 Author Report Share Posted December 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
web541 Posted December 5, 2015 Report Share Posted December 5, 2015 Oh, I forgot to mention that you have to echo the variable out, so <?php echo $fieldvalue; ?> Quote Link to comment Share on other sites More sharing options...
CGlobe Posted December 5, 2015 Author Report Share Posted December 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
web541 Posted December 5, 2015 Report Share Posted December 5, 2015 Has you got some information for STATION_CALLSIGN in your admin panel for your pilot? Quote Link to comment Share on other sites More sharing options...
CGlobe Posted December 5, 2015 Author Report Share Posted December 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
web541 Posted December 5, 2015 Report Share Posted December 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
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.