Источник: Tutorial.Custom profile fields.
Для отображения полей профиля на внешних страницах необходимо добавить следующий код (предполагается, что сессия phpBB уже интегрирована в скрипт).
В данном примере отображение дополнительных полей профиля не будет зависеть от соответствующих настроек отображения в администраторском разделе, т.е. поля отображаются в любом случае.
Код: Выделить всё
// Get custom profile fields functions
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
// Initialize custon profile field store array and class object
$profile_fields = array();
$cp = new custom_profile();
// Get custom profile fields data for current user
$profile_fields = $cp->generate_profile_fields_template('grab', $user->data['user_id']);
// Assign the data to the template
$profile_fields = (isset($profile_fields[$user->data['user_id']])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user->data['user_id']]) : array();
// Send vars to template
$template->assign_vars(array(
'S_CUSTOM_FIELDS2' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
));
if (!empty($profile_fields['row']))
{
$template->assign_vars($profile_fields['row']);
}
if (!empty($profile_fields['blockrow']))
{
foreach ($profile_fields['blockrow'] as $field_data)
{
$template->assign_block_vars('custom_fields2', $field_data);
}
}
Код: Выделить всё
<!-- BEGIN custom_fields2 --><dt>{custom_fields2.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields2.PROFILE_FIELD_VALUE}</dd><!-- END custom_fields2 -->
Код: Выделить всё
<!-- BEGIN custom_fields2 -->
<!-- IF custom_fields2.PROFILE_FIELD_NAME eq "test" -->
<dt>{custom_fields2.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields2.PROFILE_FIELD_VALUE}</dd>
<!-- ENDIF -->
<!-- END custom_fields2 -->