From 6bee91c42915dd613e9714016006b25fa51cb24a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Feb 2014 15:00:49 +0100 Subject: [ticket/12169] Convert user_from to profile field location Missing changes on memberlist view due to missing functionality PHPBB3-12169 --- .../migration/data/v310/profilefield_location.php | 47 ++++++++++++++++++++++ phpBB/phpbb/profilefields/type/type_string.php | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 phpBB/phpbb/db/migration/data/v310/profilefield_location.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php new file mode 100644 index 0000000000..ed37e079ab --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php @@ -0,0 +1,47 @@ + 'phpbb_location', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_location', + 'field_length' => '20', + 'field_minlen' => '2', + 'field_maxlen' => '100', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '.*', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + ); + + protected $user_column_name = 'user_from'; +} diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index 12a14d9b83..9d241c49ef 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -60,7 +60,7 @@ class type_string extends type_string_common $options = array( 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => ''), 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => ''), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => ''), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => ''), 3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => ''), ); -- cgit v1.2.1 From 3c46aeb0055d88919e1438941c34b97445a17878 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Feb 2014 16:32:25 +0100 Subject: [ticket/12169] Allow displaying profile fields on memberlist We can not sort by profile field values atm. And also I'm not sure whether this is possible at all. PHPBB3-12169 --- phpBB/phpbb/profilefields/manager.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index ead978374c..3948f32e93 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -246,9 +246,35 @@ class manager * Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) * This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template */ - public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) + public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false, $restrict_option = false) { - if ($mode == 'grab') + if ($mode == 'headlines') + { + if (!sizeof($this->profile_cache)) + { + $this->build_cache(); + } + + // Go through the fields in correct order + foreach ($this->profile_cache as $field_ident => $field_data) + { + if ($restrict_option && !$field_data[$restrict_option]) + { + continue; + } + + $profile_field = $this->type_collection[$field_data['field_type']]; + + $tpl_fields[] = array( + 'PROFILE_FIELD_TYPE' => $field_data['field_type'], + 'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']), + 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']), + ); + } + + return $tpl_fields; + } + else if ($mode == 'grab') { if (!is_array($user_id)) { -- cgit v1.2.1 From 995019a992ba5b0dca4cee6082af697552770c18 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Feb 2014 16:28:21 +0100 Subject: [ticket/12169] Add new option to display profile fields on memberlist PHPBB3-12169 --- .../migration/data/v310/profilefield_location.php | 1 + .../data/v310/profilefield_on_memberlist.php | 47 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php index ed37e079ab..4e62eab2d7 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_location.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_location.php @@ -15,6 +15,7 @@ class profilefield_location extends \phpbb\db\migration\profilefield_base_migrat { return array( '\phpbb\db\migration\data\v310\profilefield_types', + '\phpbb\db\migration\data\v310\profilefield_on_memberlist', ); } diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php new file mode 100644 index 0000000000..ce51944c3e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_on_memberlist.php @@ -0,0 +1,47 @@ +db_tools->sql_column_exists($this->table_prefix . 'profile_fields', 'field_show_on_ml'); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_cleanup', + ); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_ml' => array('BOOL', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_on_ml', + ), + ), + ); + } +} -- cgit v1.2.1 From 5550f0fa870d531879d53d1bfdd76dcd29a16ce6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Feb 2014 19:04:10 +0100 Subject: [ticket/12169] Split mode==headline into it's own function PHPBB3-12169 --- phpBB/phpbb/profilefields/manager.php | 53 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index 3948f32e93..6a8d32f150 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -243,38 +243,45 @@ class manager } /** - * Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) - * This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template + * Generate the template arrays in order to display the column names + * + * @param string $restrict_option Restrict the published fields to a certain profile field option + * @return array Returns an array with the template variables type, name and explain for the fields to display */ - public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false, $restrict_option = false) + public function generate_profile_fields_template_headlines($restrict_option = '') { - if ($mode == 'headlines') + if (!sizeof($this->profile_cache)) { - if (!sizeof($this->profile_cache)) + $this->build_cache(); + } + + // Go through the fields in correct order + foreach ($this->profile_cache as $field_ident => $field_data) + { + if ($restrict_option && !$field_data[$restrict_option]) { - $this->build_cache(); + continue; } - // Go through the fields in correct order - foreach ($this->profile_cache as $field_ident => $field_data) - { - if ($restrict_option && !$field_data[$restrict_option]) - { - continue; - } + $profile_field = $this->type_collection[$field_data['field_type']]; - $profile_field = $this->type_collection[$field_data['field_type']]; + $tpl_fields[] = array( + 'PROFILE_FIELD_TYPE' => $field_data['field_type'], + 'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']), + 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']), + ); + } - $tpl_fields[] = array( - 'PROFILE_FIELD_TYPE' => $field_data['field_type'], - 'PROFILE_FIELD_NAME' => $profile_field->get_field_name($field_data['lang_name']), - 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($field_data['lang_explain']), - ); - } + return $tpl_fields; + } - return $tpl_fields; - } - else if ($mode == 'grab') + /** + * Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) + * This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template + */ + public function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) + { + if ($mode == 'grab') { if (!is_array($user_id)) { -- cgit v1.2.1