From f832f5a4ee88459dae6fda7e1b303b15f84768dc Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 5 Feb 2012 22:03:02 +0800 Subject: [PATCH] [ticket/9831] Fix saving unchecked checkbox field value PHPBB3-9831 --- phpBB/includes/acp/acp_profile.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 09a7a2f9ed..a591474fce 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -511,6 +511,14 @@ class acp_profile // If we switch the type on step 2, we have to adjust field value. // 1 is a common value for the checkbox and radio buttons. + // Adjust unchecked checkbox value. + // If we return or save settings from 2nd/3rd page + // and the checkbox is unchecked, set the value to 0. + if (isset($_REQUEST['step']) && !isset($_REQUEST[$key])) + { + $var = 0; + } + // If we switch to the checkbox type but former radio buttons value was 2, // which is not the case for the checkbox, set it to 0 (unchecked). if ($cp->vars['field_length'] == 2 && $var == 2)