' . $user->lang('ACC_ACTIVATION_WARNING');
+ $message_type = E_USER_WARNING;
+ }
+ trigger_error($message . adm_back_link($this->u_action), $message_type);
}
$this->tpl_name = 'acp_board';
@@ -792,20 +800,19 @@ class acp_board
global $user, $config;
$act_ary = array(
- 'ACC_DISABLE' => USER_ACTIVATION_DISABLE,
- 'ACC_NONE' => USER_ACTIVATION_NONE,
+ 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE),
+ 'ACC_NONE' => array(true, USER_ACTIVATION_NONE),
+ 'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF),
+ 'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN),
);
- if ($config['email_enable'])
- {
- $act_ary['ACC_USER'] = USER_ACTIVATION_SELF;
- $act_ary['ACC_ADMIN'] = USER_ACTIVATION_ADMIN;
- }
- $act_options = '';
- foreach ($act_ary as $key => $value)
+ $act_options = '';
+ foreach ($act_ary as $key => $data)
{
+ list($available, $value) = $data;
$selected = ($selected_value == $value) ? ' selected="selected"' : '';
- $act_options .= '';
+ $class = (!$available) ? ' class="disabled-option"' : '';
+ $act_options .= '';
}
return $act_options;
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 88078c10af..14f6a8bc02 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -33,7 +33,8 @@ class ucp_register
global $request, $phpbb_container;
//
- if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
+ if ($config['require_activation'] == USER_ACTIVATION_DISABLE ||
+ (in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable']))
{
trigger_error('UCP_REGISTER_DISABLE');
}
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index ae7565d608..8d6c1c141d 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -221,7 +221,8 @@ $lang = array_merge($lang, array(
'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.',
'ACC_ACTIVATION' => 'Account activation',
- 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email” must be enabled in order to use user or admin activation.',
+ 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email” must be enabled in order to use user or admin activation.',
+ 'ACC_ACTIVATION_WARNING' => 'Please note that the currently selected activation method requires emails to be enabled, otherwise registration will be disabled. We recommend to either select a different activation method or reenable emails.',
'NEW_MEMBER_POST_LIMIT' => 'New member post limit',
'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the Newly Registered Users group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. A value of 0 disables this feature.',
'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default',
@@ -556,7 +557,7 @@ $lang = array_merge($lang, array(
'EMAIL_SIG' => 'Email signature',
'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.',
'ENABLE_EMAIL' => 'Enable board-wide emails',
- 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will require no activation of new accounts.',
+ 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.',
'SMTP_AUTH_METHOD' => 'Authentication method for SMTP',
'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.',
'SMTP_CRAM_MD5' => 'CRAM-MD5',
diff --git a/tests/functional/acp_registration_test.php b/tests/functional/acp_registration_test.php
new file mode 100644
index 0000000000..ef9843679e
--- /dev/null
+++ b/tests/functional/acp_registration_test.php
@@ -0,0 +1,55 @@
+
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_acp_registration_test extends phpbb_functional_test_case
+{
+ protected function set_email_enable($db, $status)
+ {
+ $sql = "UPDATE phpbb_config
+ SET config_value = '" . (($status) ? '1' : '0') . "'
+ WHERE config_name = 'email_enable'";
+ $db->sql_query($sql);
+
+ $this->purge_cache();
+ }
+
+ public function test_submitting_activation_method()
+ {
+ $db = $this->get_db();
+
+ $this->set_email_enable($db, false);
+
+ $this->add_lang('acp/board');
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
+ $this->assertContainsLang('ACP_REGISTER_SETTINGS_EXPLAIN', $this->get_content());
+
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form['config[require_activation]']->select(USER_ACTIVATION_ADMIN);
+ $crawler = self::submit($form);
+ $this->assertContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
+
+ $crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=registration&sid=' . $this->sid);
+ $form = $crawler->selectButton($this->lang('SUBMIT'))->form();
+ $form['config[require_activation]']->select(USER_ACTIVATION_NONE);
+ $crawler = self::submit($form);
+ $this->assertNotContainsLang('ACC_ACTIVATION_WARNING', $crawler->filter('div.main')->text());
+
+ $this->set_email_enable($db, true);
+ }
+}