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

roundup wordpress ecosystem january2

Roundup of WordPress ecosystem #1 – January 2017

Author: Patricia Borlovan
Last Updated: February 9th, 2017

After writing the article "Overview of the WordPress Community in 2016" and getting feedback for the article on various platforms, I decided to continue writing them, but I changed its name into "Roundup of WordPress ecosystem". This is the first article from a monthly series that will showcase what happened around the whole ecosystem in […]

Continue Reading
feb_mar_roundup_wp_ecosystem

Roundup of WordPress ecosystem #2 – February & March 2017

Author: Patricia Borlovan
Last Updated: April 11th, 2017

There were two interesting months within the WordPress ecosystem with events that are here to impact the course and development of the platform. We saw WordPress getting important security updates and a brand new design for the plugin repository and also witnessed to a significant acquisition. With this being said, let's dive into the summary […]

Continue Reading

How to Password Protect Content, Posts, and Categories in WordPress

Author: Rishi Lodha
Last Updated: July 9th, 2024

There are many use cases for password-protected content in WordPress. For example, you might be a content creator who wants to monetize premium content in the form of subscriptions or memberships. As with everything related to WordPress, password-protecting posts doesn’t have to be difficult. If you’re wondering how to password-protect WordPress content, posts, and even […]

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.