WordPress Multisite Custom Registration

Written By Steven Chang  |  PHP, Wordpress  |  0 Comments

There are quite a few plugins that solve this problem, mainly because WordPress’ Multi Site implementation isn’t as flexible and as documented as it’s single installation counterpart. We will try to make a basic custom Multisite Registration with Custom Passwords and ReCaptcha.

Warning: This is a Core Hack. This solution is messy and might break on upgrade. Since, there are no hooks that support this at the time of this writing.

First, you add registration.php to your Theme file. This piece of code hooks to WordPress’ current registration method which is in wp-signup.php

get_error_message('empty_password') ) { ?>

get_error_message('empty_confirm') ) { ?>

get_error_message('empty_captcha') ) { ?>

add('empty_password', "Please enter your desired Password below"); } if ($_POST['user_pass'] != $_POST['user_confirm_password'] || $_POST['user_confirm_password'] == '') { $result['errors']->add('empty_confirm', "Please enter your Password again"); } if (!$resp->is_valid) { $result['errors']->add('empty_captcha', "Please enter the letters you see below"); } } return $result; } function show_blogform($result) { $reg = get_option('signup_registration'); $reg[$_POST['user_email']] = $_POST['user_pass']; update_option('signup_registration', $reg); return $result; } ?>

This basically hooks the code to your WordPress installation and let’s it run when the user is on the sign up page. It also validates the passwords and the Captcha so that we don’t get any spam registrations or wrong input.

For this to work though, you need to include this file from your functions.php. Add this line anywhere on your function.php.

include 'registration.php';

You will also need the ReCaptcha PHP Library on the same directory as your registration.php file. You can download at Google. Directory must be named “recaptcha” to work, recaptchalib.php must be directly under the recaptcha directory.

Add this Snippet of code starting at line 698 on ms-functions.php on your wp-includes folder. This line is after $user_id = username_exists($user_login);

$reg = get_option('signup_registration');
$password = $reg[$user_email];
update_option('signup_registration', $reg);

This tells WordPress that we will set our own password from our password store.

After doing everything here, you should be bale to see your custom MultiSite Registration Page. You can download the files used here.

I will update the code as neccessary when this can be done as a full blown plugin.

For suggestions or modifications to the existing code. Please comment below.

About the Author

The roles I play: Husband, Dad, Son, Brother, Friend, Programmer, Investor, Trader, Marketer, Student, Teacher, Leader, Follower, Influencer