diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html
index 7a0ecce14e..bef10f8284 100644
--- a/phpBB/adm/style/acp_profile.html
+++ b/phpBB/adm/style/acp_profile.html
@@ -91,6 +91,8 @@
checked="checked" />
+
{{ lang('FIELD_ICON_EXPLAIN') }}
+
{% EVENT acp_profile_contact_after %}
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 2c364bcd86..38738d787e 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -420,5 +420,16 @@ $(function() {
}
});
+/**
+* Automatically display custom profile fields FontAwesome icon
+*/
+$(function() {
+ $('#field_icon').on('keyup blur', function() {
+ var input = $(this).val();
+ var $icon = $(this).next('i');
+ $icon.attr('class', 'icon fa-' + input + ' fa-fw');
+ });
+
+});
})(jQuery); // Avoid conflicts with other libraries
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 8cf60c2e7d..4f7b34cfde 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -360,6 +360,7 @@ class acp_profile
$field_row = array_merge($profile_field->get_default_option_values(), array(
'field_ident' => str_replace(' ', '_', utf8_clean_string($request->variable('field_ident', '', true))),
'field_required' => 0,
+ 'field_icon' => '',
'field_show_novalue'=> 0,
'field_hide' => 0,
'field_show_profile'=> 0,
@@ -381,7 +382,7 @@ class acp_profile
// $exclude contains the data we gather in each step
$exclude = array(
- 1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view', 'field_is_contact', 'field_contact_desc', 'field_contact_url'),
+ 1 => array('field_ident', 'field_icon', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_pm', 'field_show_on_vt', 'field_show_on_ml', 'field_required', 'field_show_novalue', 'field_hide', 'field_show_profile', 'field_no_view', 'field_is_contact', 'field_contact_desc', 'field_contact_url'),
2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
);
@@ -428,6 +429,7 @@ class acp_profile
$options = $profile_field->prepare_options_form($exclude, $visibility_ary);
$cp->vars['field_ident'] = ($action == 'create' && $step == 1) ? utf8_clean_string($request->variable('field_ident', $field_row['field_ident'], true)) : $request->variable('field_ident', $field_row['field_ident']);
+ $cp->vars['field_icon'] = $request->variable('field_icon', $field_row['field_icon']);
$cp->vars['lang_name'] = $request->variable('lang_name', $field_row['lang_name'], true);
$cp->vars['lang_explain'] = $request->variable('lang_explain', $field_row['lang_explain'], true);
$cp->vars['lang_default_value'] = $request->variable('lang_default_value', $field_row['lang_default_value'], true);
@@ -648,6 +650,7 @@ class acp_profile
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
'FIELD_TYPE' => $profile_field->get_name(),
'FIELD_IDENT' => $cp->vars['field_ident'],
+ 'FIELD_ICON' => $cp->vars['field_icon'],
'LANG_NAME' => $cp->vars['lang_name'],
'LANG_EXPLAIN' => $cp->vars['lang_explain'],
);
@@ -984,6 +987,7 @@ class acp_profile
'field_is_contact' => $cp->vars['field_is_contact'],
'field_contact_desc' => $cp->vars['field_contact_desc'],
'field_contact_url' => $cp->vars['field_contact_url'],
+ 'field_icon' => $cp->vars['field_icon'],
);
$field_data = $cp->vars;
diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php
index 579235c912..f924a97e0d 100644
--- a/phpBB/language/en/acp/profile.php
+++ b/phpBB/language/en/acp/profile.php
@@ -93,6 +93,8 @@ $lang = array_merge($lang, array(
'FIELD_DESCRIPTION' => 'Field description',
'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.',
'FIELD_DROPDOWN' => 'Dropdown box',
+ 'FIELD_ICON' => 'Field icon',
+ 'FIELD_ICON_EXPLAIN' => 'Enter the name of a Font Awesome icon to use with the field while displaying in the mini-profile on the topic screen. Leave this field blank to use phpBB default contact image icon.',
'FIELD_IDENT' => 'Field identification',
'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.',
'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.',
diff --git a/phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php b/phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php
new file mode 100644
index 0000000000..6376f6cd4c
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php
@@ -0,0 +1,49 @@
+
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v330;
+
+class custom_profile_field_contact_icon extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_icon');
+ }
+
+ public static function depends_on()
+ {
+ return ['\phpbb\db\migration\data\v330\v330',];
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_columns' => [
+ $this->table_prefix . 'profile_fields' => [
+ 'field_icon' => array('VCHAR:255', ''),
+ ],
+ ],
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_columns' => array(
+ $this->table_prefix . 'profile_fields' => array(
+ 'field_icon',
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 7cc37e12ce..8ed6870576 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -332,6 +332,7 @@ class manager
$tpl_fields[] = [
'PROFILE_FIELD_IDENT' => $field_ident,
+ 'PROFILE_FIELD_ICON' => $field_data['field_icon'],
'PROFILE_FIELD_TYPE' => $field_data['field_type'],
'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']),
'PROFILE_FIELD_EXPLAIN' => $this->language->lang($field_data['lang_explain']),
@@ -484,6 +485,7 @@ class manager
$tpl_fields['row'] += [
"PROFILE_{$ident_upper}_IDENT" => $ident,
+ "PROFILE_{$ident_upper}_ICON" => $ident_ary['data']['field_icon'],
"PROFILE_{$ident_upper}_VALUE" => $value,
"PROFILE_{$ident_upper}_VALUE_RAW" => $value_raw,
"PROFILE_{$ident_upper}_CONTACT" => $contact_url,
@@ -498,6 +500,7 @@ class manager
$tpl_fields['blockrow'][] = [
'PROFILE_FIELD_IDENT' => $ident,
+ 'PROFILE_FIELD_ICON' => $ident_ary['data']['field_icon'],
'PROFILE_FIELD_VALUE' => $value,
'PROFILE_FIELD_VALUE_RAW' => $value_raw,
'PROFILE_FIELD_CONTACT' => $contact_url,
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index febc2d35d4..15bd6abb72 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -193,7 +193,9 @@
class="last-cell">
{% EVENT viewtopic_body_contact_icon_prepend %}
- {% if postrow.contact.ID == 'pm' %}
+ {% if postrow.contact.ICON %}
+ {{ Icon('font', contact.ICON, '', true, '') }}
+ {% elseif postrow.contact.ID == 'pm' %}
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
{% elseif postrow.contact.ID == 'email' %}
{{ Icon('font', 'at', '', true, 'fas contact-icon') }}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 3181204292..6bb4450b16 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -2195,6 +2195,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i)
{
$template->assign_block_vars('postrow.contact', array(
'ID' => $field_data['PROFILE_FIELD_IDENT'],
+ 'ICON' => $field_data['PROFILE_FIELD_ICON'],
'NAME' => $field_data['PROFILE_FIELD_NAME'],
'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'],
));