Blog / Tutorials / WordPress Begin User Registration at a Specific Date and Time

WordPress Begin User Registration at a Specific Date and Time

Cristian Antohe
Last Updated: 24/03/16

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.

From the blog

Related Articles

what-is-wordpress-ver-2

Beginner’s Guide to: What Is WordPress?

Author: Cristian Antohe
Last Updated: February 15th, 2017

Ever now and again the question arises with new clients that aren't really tech savvy: "What Is WordPress?" What I'm hoping to achieve with this post is to drop the technical jargon for a minute and explain in down to earth words what is WordPress, how can it help you, what is WordPress.com, what's a […]

Continue Reading

How to Eliminate WordPress Spam Registrations (Step-by-Step Guide)

Author: Adrian Spiac
Last Updated: December 11th, 2019

Looking for a way to cut down on WordPress spam registrations? If your WordPress site is set to allow user registration (like a membership site or WooCommerce store), then it's probably vulnerable to user registration spam from spam-bots. Finding a way to eliminate, or at least reduce, WordPress spam registrations is important so that you can focus your efforts and resources on your real users. No matter what type of site you're running, there are some tried-and-true tactics that you can apply to stop spam registrations in their tracks, and they're all available in one single plugin.

Continue Reading

WordPress User Registration

Author: Cristian Antohe
Last Updated: February 24th, 2020

Have you hit a road block when it comes to WordPress user registration? You probably would like to have new users register before being able to take certain actions (for example, posting reviews or commenting) but do not want them to have access to the WordPress Dashboard? Truth is, WordPress User Registration doesn't have to […]

Continue Reading

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

    I think thats a great information..thank you for giving me the necessary information

    Reply

    thanks you nice sharing, thats so useful for me

    Reply

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.