diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html
index bef10f8284..6a0b3ae11d 100644
--- a/phpBB/adm/style/acp_profile.html
+++ b/phpBB/adm/style/acp_profile.html
@@ -92,7 +92,7 @@
{{ lang('FIELD_ICON_EXPLAIN') }}
-
+ {{ Icon('font', FIELD_ICON, '', true, {'style': 'color: #' ~ FIELD_ICON_COLOR}) }}
{% EVENT acp_profile_contact_after %}
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 4f7b34cfde..9dc95ece36 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -360,7 +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_icon' => json_encode(['name' => '', 'color' => '']),
'field_show_novalue'=> 0,
'field_hide' => 0,
'field_show_profile'=> 0,
@@ -428,8 +428,12 @@ class acp_profile
$options = $profile_field->prepare_options_form($exclude, $visibility_ary);
+ $field_icon_data = json_decode($field_row['field_icon'], true);
+ $cp->vars['field_icon'] = json_encode([
+ 'name' => $request->variable('field_icon', $field_icon_data['name'] ?: ''),
+ 'color' => $request->variable('field_icon_color', $field_icon_data['color'] ?: ''),
+ ]);
$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);
@@ -632,6 +636,7 @@ class acp_profile
{
// Create basic options - only small differences between field types
case 1:
+ $field_icon_data = json_decode($cp->vars['field_icon'], true);
$template_vars = array(
'S_STEP_ONE' => true,
'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false,
@@ -650,7 +655,8 @@ 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'],
+ 'FIELD_ICON' => $field_icon_data['name'],
+ 'FIELD_ICON_COLOR' => $field_icon_data['color'],
'LANG_NAME' => $cp->vars['lang_name'],
'LANG_EXPLAIN' => $cp->vars['lang_explain'],
);
diff --git a/phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php b/phpBB/phpbb/db/migration/data/v400/custom_profile_field_contact_icon.php
similarity index 56%
rename from phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php
rename to phpBB/phpbb/db/migration/data/v400/custom_profile_field_contact_icon.php
index 6376f6cd4c..9df240f495 100644
--- a/phpBB/phpbb/db/migration/data/v330/custom_profile_field_contact_icon.php
+++ b/phpBB/phpbb/db/migration/data/v400/custom_profile_field_contact_icon.php
@@ -1,17 +1,17 @@
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited
+ * @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;
+namespace phpbb\db\migration\data\v400;
class custom_profile_field_contact_icon extends \phpbb\db\migration\migration
{
@@ -22,7 +22,9 @@ class custom_profile_field_contact_icon extends \phpbb\db\migration\migration
public static function depends_on()
{
- return ['\phpbb\db\migration\data\v330\v330',];
+ return [
+ '\phpbb\db\migration\data\v400\dev',
+ ];
}
public function update_schema()
@@ -30,7 +32,7 @@ class custom_profile_field_contact_icon extends \phpbb\db\migration\migration
return array(
'add_columns' => [
$this->table_prefix . 'profile_fields' => [
- 'field_icon' => array('VCHAR:255', ''),
+ 'field_icon' => array('VCHAR:255', json_encode(['name' => '', 'color' => ''])),
],
],
);
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 15bd6abb72..778830429a 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -194,7 +194,8 @@
class="last-cell">
{% EVENT viewtopic_body_contact_icon_prepend %}
{% if postrow.contact.ICON %}
- {{ Icon('font', contact.ICON, '', true, '') }}
+ {% set color = postrow.contact.ICON_COLOR ? ('color: #' ~ contact.ICON_COLOR) : '' %}
+ {{ Icon('font', contact.ICON, '', true, '', '', {'style': color}) }}
{% elseif postrow.contact.ID == 'pm' %}
{{ Icon('font', 'message', '', true, 'far contact-icon') }}
{% elseif postrow.contact.ID == 'email' %}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 6bb4450b16..7f2ce77eb8 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -2193,9 +2193,11 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i)
if ($field_data['S_PROFILE_CONTACT'])
{
+ $icon_data = json_decode($field_data['PROFILE_FIELD_ICON'], true);
$template->assign_block_vars('postrow.contact', array(
'ID' => $field_data['PROFILE_FIELD_IDENT'],
- 'ICON' => $field_data['PROFILE_FIELD_ICON'],
+ 'ICON' => $icon_data['name'],
+ 'ICON_COLOR'=> $icon_data['color'],
'NAME' => $field_data['PROFILE_FIELD_NAME'],
'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'],
));