mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-19 07:16:36 +02:00
[ticket/12187] Do not make clickable when using as contact field
PHPBB3-12187
This commit is contained in:
parent
c650078904
commit
03ef39c1f1
@ -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(
|
||||
|
@ -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 = $contact_url = '';
|
||||
if ($use_contact_fields)
|
||||
{
|
||||
$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);
|
||||
$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(
|
||||
|
@ -84,6 +84,14 @@ abstract class type_base implements type_interface
|
||||
return isset($this->user->lang[$field_name]) ? $this->user->lang[$field_name] : $field_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get_profile_contact_value($field_value, $field_data)
|
||||
{
|
||||
return $this->get_profile_value($field_value, $field_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -89,6 +89,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
|
||||
*
|
||||
|
@ -102,6 +102,19 @@ abstract class type_string_common extends type_base
|
||||
return $field_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -48,19 +48,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}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user