aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/phpbb/profilefields/manager.php35
-rw-r--r--phpBB/phpbb/profilefields/type/type_base.php8
-rw-r--r--phpBB/phpbb/profilefields/type/type_interface.php11
-rw-r--r--phpBB/phpbb/profilefields/type/type_string_common.php13
-rw-r--r--phpBB/phpbb/profilefields/type/type_url.php13
6 files changed, 54 insertions, 28 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index a05a0999dc..7d64ad8125 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1592,7 +1592,7 @@ switch ($mode)
$cp_row = array();
if ($config['load_cpf_memberlist'])
{
- $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id]) : array();
+ $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array();
}
$memberrow = array_merge(show_profile($row), array(
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index 8b4a3917f2..a4626bc5de 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -337,12 +337,14 @@ class manager
}
/**
- * Assign the user's profile fields data to the template
- *
- * @param array $profile_row Array with users profile field data
- * @return array
- */
- public function generate_profile_fields_template_data($profile_row)
+ * Assign the user's profile fields data to the template
+ *
+ * @param array $profile_row Array with users profile field data
+ * @param bool $use_contact_fields Should we display contact fields as such?
+ * This requires special treatments (links should not be parsed in the values, and more)
+ * @return array
+ */
+ public function generate_profile_fields_template_data($profile_row, $use_contact_fields = true)
{
// $profile_row == $user_fields[$row['user_id']];
$tpl_fields = array();
@@ -358,15 +360,20 @@ class manager
continue;
}
- $field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
- if (strpos($field_desc, '%s') !== false)
- {
- $field_desc = sprintf($field_desc, $value);
- }
- $contact_url = '';
- if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false)
+ $field_desc = $contact_url = '';
+ if ($use_contact_fields)
{
- $contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
+ $value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']);
+ $field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
+ if (strpos($field_desc, '%s') !== false)
+ {
+ $field_desc = sprintf($field_desc, $value);
+ }
+ $contact_url = '';
+ if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false)
+ {
+ $contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
+ }
}
$tpl_fields['row'] += array(
diff --git a/phpBB/phpbb/profilefields/type/type_base.php b/phpBB/phpbb/profilefields/type/type_base.php
index 9c363a7b4e..a96196674d 100644
--- a/phpBB/phpbb/profilefields/type/type_base.php
+++ b/phpBB/phpbb/profilefields/type/type_base.php
@@ -87,6 +87,14 @@ abstract class type_base implements type_interface
/**
* {@inheritDoc}
*/
+ public function get_profile_contact_value($field_value, $field_data)
+ {
+ return $this->get_profile_value($field_value, $field_data);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function get_language_options_input($field_data)
{
$field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php
index 94f6882524..a1c3d879c8 100644
--- a/phpBB/phpbb/profilefields/type/type_interface.php
+++ b/phpBB/phpbb/profilefields/type/type_interface.php
@@ -90,6 +90,17 @@ interface type_interface
public function get_profile_value($field_value, $field_data);
/**
+ * Get Profile Value for display
+ *
+ * When displaying a contact field, we don't want to have links already parsed and more
+ *
+ * @param mixed $field_value Field value as stored in the database
+ * @param array $field_data Array with requirements of the field
+ * @return mixed Field value to display
+ */
+ public function get_profile_contact_value($field_value, $field_data);
+
+ /**
* Generate the input field for display
*
* @param array $profile_row Array with data for this field
diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php
index f00a7e6a08..d5fb8f4b97 100644
--- a/phpBB/phpbb/profilefields/type/type_string_common.php
+++ b/phpBB/phpbb/profilefields/type/type_string_common.php
@@ -105,6 +105,19 @@ abstract class type_string_common extends type_base
/**
* {@inheritDoc}
*/
+ public function get_profile_contact_value($field_value, $field_data)
+ {
+ if (!$field_value && !$field_data['field_show_novalue'])
+ {
+ return null;
+ }
+
+ return $field_value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function prepare_options_form(&$exclude_options, &$visibility_options)
{
$exclude_options[1][] = 'lang_default_value';
diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php
index 08f976cf4b..b1523b9355 100644
--- a/phpBB/phpbb/profilefields/type/type_url.php
+++ b/phpBB/phpbb/profilefields/type/type_url.php
@@ -49,19 +49,6 @@ class type_url extends type_string
}
/**
- * {@inheritDoc}
- */
- public function get_profile_value($field_value, $field_data)
- {
- if (!$field_value && !$field_data['field_show_novalue'])
- {
- return null;
- }
-
- return $field_value;
- }
-
- /**
* {@inheritDoc}
*/
public function validate_profile_field(&$field_value, $field_data)