From 6fac65d19393eaa3135e42f317033f6dcb7c9319 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 1 Oct 2023 21:20:00 +0200 Subject: [PATCH] [ticket/12904] Do not display info about required fields without any PHPBB3-12904 --- phpBB/phpbb/profilefields/manager.php | 12 +++++++++--- phpBB/styles/prosilver/template/ucp_register.html | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php index bf7096ca42..c289333428 100644 --- a/phpBB/phpbb/profilefields/manager.php +++ b/phpBB/phpbb/profilefields/manager.php @@ -154,8 +154,10 @@ class manager break; } + $has_required = false; + $sql = 'SELECT l.*, f.* - FROM ' . $this->fields_lang_table . ' l, + FROM ' . $this->fields_lang_table . ' l, ' . $this->fields_table . ' f WHERE l.field_id = f.field_id AND f.field_active = 1 @@ -168,6 +170,8 @@ class manager /** @var \phpbb\profilefields\type\type_interface $profile_field */ $profile_field = $this->type_collection[$row['field_type']]; + $has_required = $has_required || $row['field_required']; + $this->template->assign_block_vars('profile_fields', [ 'FIELD' => $profile_field->process_field_row('change', $row), 'FIELD_ID' => $profile_field->get_field_ident($row), @@ -177,6 +181,8 @@ class manager ]); } $this->db->sql_freeresult($result); + + $this->template->assign_var('PROFILE_FIELDS_REQUIRED', $has_required); } /** @@ -192,7 +198,7 @@ class manager $sql_where = !$this->auth->acl_gets('a_', 'm_') && !$this->auth->acl_getf_global('m_') ? ' AND f.field_hide = 0' : ''; $sql = 'SELECT l.*, f.* - FROM ' . $this->fields_lang_table . ' l, + FROM ' . $this->fields_lang_table . ' l, ' . $this->fields_table . ' f WHERE l.field_id = f.field_id AND f.field_active = 1 @@ -241,7 +247,7 @@ class manager } $sql = 'SELECT l.*, f.* - FROM ' . $this->fields_lang_table . ' l, + FROM ' . $this->fields_lang_table . ' l, ' . $this->fields_table . ' f WHERE l.field_id = f.field_id AND f.field_active = 1 diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index adbe173b97..069e4f1075 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -67,8 +67,7 @@ - -
{L_ITEMS_REQUIRED}
+ {% if PROFILE_FIELDS_REQUIRED %}
{L_ITEMS_REQUIRED}
{% endif %}
@@ -78,7 +77,6 @@
{profile_fields.FIELD}
-