Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: merc123 on August 12, 2014, 11:56:25 AM

Title: Custom profile fields in Display.template.php
Post by: merc123 on August 12, 2014, 11:56:25 AM
I am trying to pull some of the custom profile fields to put into the Display.template.php.  I've done a lot of searching but can't come up with any solutions.

The database field is "cust_regist".

This shows me some info that I used many versions ago with the Custom Profile MOD (3rd party) and these are not prefixed with "cust_" in the database.
Mod link:  http://custom.simplemachines.org/mods/?mod=319 
print_r($message['member']['custom_fields'])


Doing this shows nothing:
print_r($context['custom_fields'])



This is currently used in the Display.template.php and displays the contents of the info that was used in the 3rd party mod.

// Any custom fields for standard placement?
if (!empty($message['member']['custom_fields']))
{
foreach ($message['member']['custom_fields'] as $custom)
if (empty($custom['placement']) || empty($custom['value']))
echo '
<li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';
}




----------------- UPDATE ------------------

About 2 minutes after posting this I came up with the solution.  The "cust_regist" field setting in the Admin, Profile Fields list did not have " Show on Topic View: " checked.   After checking this box the field is now available.