aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-02-10 19:04:10 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-02-10 19:04:10 +0100
commit5550f0fa870d531879d53d1bfdd76dcd29a16ce6 (patch)
tree779a80bc5d106afaff20a28675ba7e69771a7262
parent995019a992ba5b0dca4cee6082af697552770c18 (diff)
downloadforums-5550f0fa870d531879d53d1bfdd76dcd29a16ce6.tar
forums-5550f0fa870d531879d53d1bfdd76dcd29a16ce6.tar.gz
forums-5550f0fa870d531879d53d1bfdd76dcd29a16ce6.tar.bz2
forums-5550f0fa870d531879d53d1bfdd76dcd29a16ce6.tar.xz
forums-5550f0fa870d531879d53d1bfdd76dcd29a16ce6.zip
[ticket/12169] Split mode==headline into it's own function
PHPBB3-12169
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/phpbb/profilefields/manager.php53
2 files changed, 31 insertions, 24 deletions
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 62e0a13445..16e4c86a4e 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1508,7 +1508,7 @@ switch ($mode)
{
$cp = $phpbb_container->get('profilefields.manager');
- $cp_row = $cp->generate_profile_fields_template('headlines', false, false, 'field_show_on_ml');
+ $cp_row = $cp->generate_profile_fields_template_headlines('field_show_on_ml');
foreach ($cp_row as $profile_field)
{
$template->assign_block_vars('custom_fields', $profile_field);
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))
{