diff --git a/config/config.default.php b/config/config.default.php
index 606fa143..0328e500 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -110,7 +110,6 @@ return [
// Available T-Shirt sizes, set value to null if not available
'tshirt_sizes' => [
- '' => _('Please select...'),
'S' => 'S',
'S-G' => 'S Girl',
'M' => 'M',
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 33a7e01e..35dbe60b 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -244,18 +244,16 @@ function admin_active()
$shirt_statistics = [];
foreach (array_keys($tshirt_sizes) as $size) {
- if (!empty($size)) {
- $gc = DB::selectOne(
- 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1',
- [$size]
- );
- $gc = array_shift($gc);
+ $gc = DB::selectOne(
+ 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1',
+ [$size]
+ );
+ $gc = array_shift($gc);
- $shirt_statistics[] = [
- 'size' => $size,
- 'given' => (int)$gc
- ];
- }
+ $shirt_statistics[] = [
+ 'size' => $size,
+ 'given' => (int)$gc
+ ];
}
$shirtCount = User_tshirts_count();
diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php
index 514e4b1b..2841c278 100644
--- a/includes/pages/admin_user.php
+++ b/includes/pages/admin_user.php
@@ -18,13 +18,6 @@ function admin_user()
global $user, $privileges;
$tshirt_sizes = config('tshirt_sizes');
$request = request();
-
- foreach ($tshirt_sizes as $key => $size) {
- if (empty($size)) {
- unset($tshirt_sizes[$key]);
- }
- }
-
$html = '';
if (!$request->has('id')) {
@@ -68,7 +61,7 @@ function admin_user()
}
$html .= "
jabber | " . ' |
' . "\n";
$html .= ' Size | '
- . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . ' |
' . "\n";
+ . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size'], _('Please select...')) . '' . "\n";
$options = [
'1' => _('Yes'),
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index 47e16915..d23d9f96 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -69,12 +69,6 @@ function guest_register()
}
}
- foreach ($tshirt_sizes as $key => $size) {
- if (empty($size)) {
- unset($tshirt_sizes[$key]);
- }
- }
-
if (!in_array('register', $privileges) || (!isset($user) && !config('registration_enabled'))) {
error(_('Registration is disabled.'));
@@ -334,7 +328,7 @@ function guest_register()
div('col-sm-6', [
$enable_tshirt_size ? form_select('tshirt_size',
_('Shirt size') . ' ' . entry_required(),
- $tshirt_sizes, $tshirt_size) : ''
+ $tshirt_sizes, $tshirt_size, _('Please select...')) : ''
])
]),
div('row', [
diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php
index b3a5bdf5..930d55d9 100644
--- a/includes/pages/user_settings.php
+++ b/includes/pages/user_settings.php
@@ -224,12 +224,6 @@ function user_settings()
}
}
- foreach ($tshirt_sizes as $key => $size) {
- if (empty($size)) {
- unset($tshirt_sizes[$key]);
- }
- }
-
$user_source = $user;
if ($request->has('submit')) {
diff --git a/includes/sys_form.php b/includes/sys_form.php
index 9cb6f38d..b75c7316 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -367,11 +367,16 @@ function form_textarea($name, $label, $value, $disabled = false)
* @param string $label
* @param string[] $values
* @param string $selected
+ * @param string $selectText
* @return string
*/
-function form_select($name, $label, $values, $selected)
+function form_select($name, $label, $values, $selected, $selectText = '')
{
- return form_element($label, html_select_key('form_' . $name, $name, $values, $selected), 'form_' . $name);
+ return form_element(
+ $label,
+ html_select_key('form_' . $name, $name, $values, $selected, $selectText),
+ 'form_' . $name
+ );
}
/**
@@ -425,11 +430,15 @@ function html_options($name, $options, $selected = '')
* @param string $name
* @param string[] $rows
* @param string $selected
+ * @param string $selectText
* @return string
*/
-function html_select_key($dom_id, $name, $rows, $selected)
+function html_select_key($dom_id, $name, $rows, $selected, $selectText = '')
{
$html = '