Minimum time to register

Sets a minimum time limit that must pass before the submit button on the registration page is enabled

Requested by sharky86 in this topic, this is a feature that actually used to be part of phpBB 3 but was removed as of 3.0.1. It adds a minimum time limit (configurable in the ACP 'User Registration Settings' Page) that has to be passed before the submit button on the registration page is enabled.

#
#-----[ SQL ]------------------------------------------
#
    INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_time_reg', '5');
    INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_time_terms', '2');
#
#-----[ OPEN ]------------------------------------------
#
includes/acp/acp_board.php
#
#-----[ FIND ]------------------------------------------
#
                            'max_reg_attempts'        => array('lang' => 'REG_LIMIT',                'validate' => 'int',    'type' => 'text:4:4', 'explain' => true),  
#
#-----[ AFTER ADD ]------------------------------------------
#
                            'min_time_reg'            => array('lang' => 'MIN_TIME_REG',            'validate' => 'int',    'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
                            'min_time_terms'        => array('lang' => 'MIN_TIME_TERMS',        'validate' => 'int',    'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),  
#
#-----[ OPEN ]------------------------------------------
#
includes/ucp/ucp_register.php
#
#-----[ FIND ]------------------------------------------
#
            $user_lang        = request_var('lang', $user->lang_name); 
#
#-----[ AFTER ADD ]------------------------------------------
#
            // not so fast, buddy
            if (($submit && !check_form_key('ucp_register', false, '', false, $config['min_time_reg']))
                || (!$submit && !check_form_key('ucp_register_terms', false, '', false, $config['min_time_terms'])))
            {
                $agreed = false;
            } 
#
#-----[ FIND ]------------------------------------------
#
                        'S_UCP_ACTION'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa), 
#
#-----[ AFTER ADD ]------------------------------------------
#
                        'S_TIME'            => 1000 * ((int) $config['min_time_terms']), 
#
#-----[ FIND ]------------------------------------------
#
                )
            );

            //
            $user->profile_fields = array(); 
#
#-----[ BEFORE ADD ]------------------------------------------
#
                'S_TIME'            => 1000 * ((int) $config['min_time_reg']), 
#
#-----[ OPEN ]------------------------------------------
#
language/en/acp/board.php
#
#-----[ FIND ]------------------------------------------
#
        'MIN_CHARS'                    => 'Min', 
#
#-----[ AFTER ADD ]------------------------------------------
#
        'MIN_TIME_REG'                => 'Minimum time for registration',
        'MIN_TIME_REG_EXPLAIN'        => 'The registration form cannot be submitted before this time has passed.',
        'MIN_TIME_TERMS'              => 'Minimum time for accepting terms',
        'MIN_TIME_TERMS_EXPLAIN'      => 'The terms page cannot be skipped before this time has passed.', 
#
#-----[ OPEN ]------------------------------------------
#
styles/prosilver/template/ucp_register.html
#
#-----[ FIND ]------------------------------------------
#
          document.forms['register'].submit.click();
       }
#
#-----[ AFTER ADD ]------------------------------------------
#
       function disable(disabl, name)
       {
          document.getElementById(name).disabled = disabl;
          if (disabl)
          {
             document.getElementById(name).className = 'button1 disabled';
          }
          else
          {
             document.getElementById(name).className = 'button1 enabled';
          }
       }
       
       <!-- IF S_TIME -->
          onload_functions.push('disable(true, "submit")');
          setTimeout('disable(false, "submit")', {S_TIME});
       <!-- ENDIF -->