mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 03:34:04 +02:00
[ticket/12759] Cache the lang options earlier
Previously it would re-run on every post PHPBB3-12759
This commit is contained in:
@@ -367,6 +367,34 @@ class manager
|
||||
return $user_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache user's profile fields' language options
|
||||
* @param array $profile_row Array with users profile field data
|
||||
* @return void
|
||||
*/
|
||||
public function cache_profile_fields_lang_options($profile_row)
|
||||
{
|
||||
if (!empty($profile_row))
|
||||
{
|
||||
$field_ids = array();
|
||||
foreach ($profile_row as $ident_ary)
|
||||
{
|
||||
if (empty($field_ids[$ident_ary['data']['lang_id']]))
|
||||
{
|
||||
$field_ids[$ident_ary['data']['lang_id']] = array();
|
||||
|
||||
}
|
||||
|
||||
$field_ids[$ident_ary['data']['lang_id']][] = $ident_ary['data']['field_id'];
|
||||
}
|
||||
|
||||
foreach ($field_ids as $lang => $fields)
|
||||
{
|
||||
$this->lang_helper->get_option_lang($fields, $lang, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign the user's profile fields data to the template
|
||||
*
|
||||
@@ -393,25 +421,6 @@ class manager
|
||||
$vars = array('profile_row', 'tpl_fields', 'use_contact_fields');
|
||||
extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_data_before', compact($vars)));
|
||||
|
||||
if (!empty($profile_row))
|
||||
{
|
||||
$field_ids = array();
|
||||
foreach ($profile_row as $ident_ary)
|
||||
{
|
||||
if (empty($field_ids[$ident_ary['data']['lang_id']]))
|
||||
{
|
||||
$field_ids[$ident_ary['data']['lang_id']] = array();
|
||||
|
||||
}
|
||||
$field_ids[$ident_ary['data']['lang_id']][] = $ident_ary['data']['field_id'];
|
||||
}
|
||||
|
||||
foreach ($field_ids as $lang => $fields)
|
||||
{
|
||||
$this->lang_helper->get_option_lang($fields, $lang, false);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($profile_row as $ident => $ident_ary)
|
||||
{
|
||||
$profile_field = $this->type_collection[$ident_ary['data']['field_type']];
|
||||
|
Reference in New Issue
Block a user