mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12187] Do not make clickable when using as contact field
PHPBB3-12187
This commit is contained in:
parent
c650078904
commit
03ef39c1f1
6 changed files with 54 additions and 28 deletions
|
@ -1592,7 +1592,7 @@ switch ($mode)
|
||||||
$cp_row = array();
|
$cp_row = array();
|
||||||
if ($config['load_cpf_memberlist'])
|
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(
|
$memberrow = array_merge(show_profile($row), array(
|
||||||
|
|
|
@ -340,9 +340,11 @@ class manager
|
||||||
* Assign the user's profile fields data to the template
|
* Assign the user's profile fields data to the template
|
||||||
*
|
*
|
||||||
* @param array $profile_row Array with users profile field data
|
* @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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function generate_profile_fields_template_data($profile_row)
|
public function generate_profile_fields_template_data($profile_row, $use_contact_fields = true)
|
||||||
{
|
{
|
||||||
// $profile_row == $user_fields[$row['user_id']];
|
// $profile_row == $user_fields[$row['user_id']];
|
||||||
$tpl_fields = array();
|
$tpl_fields = array();
|
||||||
|
@ -358,6 +360,10 @@ class manager
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$field_desc = $contact_url = '';
|
||||||
|
if ($use_contact_fields)
|
||||||
|
{
|
||||||
|
$value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']);
|
||||||
$field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
|
$field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
|
||||||
if (strpos($field_desc, '%s') !== false)
|
if (strpos($field_desc, '%s') !== false)
|
||||||
{
|
{
|
||||||
|
@ -368,6 +374,7 @@ class manager
|
||||||
{
|
{
|
||||||
$contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
|
$contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$tpl_fields['row'] += array(
|
$tpl_fields['row'] += array(
|
||||||
'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident,
|
'PROFILE_' . strtoupper($ident) . '_IDENT' => $ident,
|
||||||
|
|
|
@ -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;
|
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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,6 +89,17 @@ interface type_interface
|
||||||
*/
|
*/
|
||||||
public function get_profile_value($field_value, $field_data);
|
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
|
* Generate the input field for display
|
||||||
*
|
*
|
||||||
|
|
|
@ -102,6 +102,19 @@ abstract class type_string_common extends type_base
|
||||||
return $field_value;
|
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}
|
* {@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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue