How to disable bbpress registration?
January 14th, 2011 at 12:55pm Jason 299 views
Q: how can I disable registration in bbpress? I have added the Admin add user plug-in. and want to restrict registration so it is done manually.
A: Rather than editing or removing core files, This is a simple plugin can disable bbpress registration. U can use your plugin or link your user to register on ur wordpress website if you have Integrated your wordpress and bbpress.
<?php /* Plugin Name: Disable Registrations Description: This plugin disables access to registration.php and blocks any registrations. 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' ); ?>
Entry Filed under: WordPress Tagged with: bbpress PHP plugin website wordpress
Hot Posts Hot Comments Hot Tags
- apartment bbpress blog class CMS code CSS div dream english friends girl Google hot Hot Dog html job JS life lines love Madonna menu Michael Jackson movie oral english PHP plugin saying school sexy site student students submenu success tags teacher teaching txt university video website widget wordpress





1 Comment Add your own
1. xiaodi zhan | August 2nd, 2011 at 9:49 am
good
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
Trackback this post | Subscribe to the comments via RSS Feed