Skip to:

Re: how to disable registration ?

Simon Wheatley


Rather than editing or removing core files, I wrote this simple plugin:

Plugin Name: Disable Registrations
Description: This plugin disables access to registration.php and blocks any registrations.
Plugin URI:
Author: Simon Wheatley
Author URI:
Version: 0.1

// Fires every time bbPress inits, a bit ick but it's super quick string ops
// (which is what PHP is good at).
function da_disable_registrations()
// Shame there isn't a hook to grab before the new user is registered on register.php
// In the absence of that, we will check whether we're on register.php
if ( ! da_str_ends_with( strtolower( $_SERVER[ 'PHP_SELF' ] ), 'register.php' ) ) return;
// We are on register.php? Stop executing (with a message).
bb_die( "Registration is not allowed on this website. Please contact the site administrators." );
exit; // Never reached, unless bb_die fails for some freaky reason

// Checks whether string a ends with string b
function da_str_ends_with(& $str, $end)
return ( substr( $str, - strlen( $end ), strlen( $end ) ) == $end );

add_action( 'bb_init', 'da_disable_registrations' );


Skip to toolbar