From 03ef39c1f18584b331b5ddbd59e94848b8d3cd17 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 4 Mar 2014 09:10:57 +0100 Subject: [ticket/12187] Do not make clickable when using as contact field PHPBB3-12187 --- phpBB/phpbb/profilefields/manager.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'phpBB/phpbb/profilefields/manager.php') 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( -- cgit v1.2.1