WordPress Begin User Registration at a Specific Date and Time

Sometimes you want to begin user registrations in your WordPress site at a particular date and time in the future. Luckily it’s simple enough and it requires just a small plugin.

There’s no UI and you’ll have to modify the $open_registration_time variable with your time and hour, but it’s as simple as it gets:

  • create a new file auto_start_registration.php
  • copy the code from this page in it
  • modify the $open_registration_time variable with your time and date similar to the format
  • copy the file via FTP in your /plugins folder and activate the plugin

The plugin checks for the WordPress local time, so make sure you setup registration start based on it, not your local time or UTC time.

current_WordPress_time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
 * @package Auto_Start_Registration
 * @version 1.0
 */
/*
Plugin Name: Auto Start Registration
Plugin URI: http://www.cozmoslabs.com
Description: Registration can begin at a specific date and time. This is using the WordPress current time, not UTC time. 
Author: Cristian Antohe
Version: 1.0
Author URI: http://www.cozmoslabs.com
*/
 
 
//we're running this on init and not in a cron job since crons run hourly and don't offer enough control. 
// also it's quite lightweight. 
add_action('init', 'asr_auto_start_registration');
function asr_auto_start_registration(){
 
    // This is using the WordPress current time, not UTC time. 
    $open_registration_time = '24 March 2016 9 hours 1 minute';
    if( ( get_option('asr_stop_check', '0') == '0' ) && ( current_time( 'timestamp' ) > strtotime($open_registration_time ) ) ){
        update_option('users_can_register', '1');
        update_option('asr_stop_check', '1', true);
    }
}

You can also use this with our Profile Builder plugin since our registration forms checks if “Anyone can register” is set or not.

Subscribe to get early access

to new plugins, discounts and brief updates about what's new with Cozmoslabs!

2 thoughts on “WordPress Begin User Registration at a Specific Date and Time

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.