Advertisement
Guest User

WordPress Multisite Signup at Sub-blog

a guest
Nov 30th, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. /**
  2.  * Removes Theme_My_Login_MS_Signup::tml_request_register
  3.  */
  4. function tml_init() {
  5.     global $theme_my_login_ms_signup;
  6.  
  7.     remove_action( 'tml_request_register', array( &$theme_my_login_ms_signup, 'tml_request_register' ) );
  8. }
  9. add_action( 'init', 'tml_init' );
  10.  
  11. /**
  12.  * Replace Theme_My_Login_MS_Signup::tml_request_register with a version that doesn't redirect to the main site
  13.  *
  14.  * @param object $theme_my_login Reference to global Theme My Login object
  15.  */
  16. function tml_request_register( &$theme_my_login ) {
  17.     global $theme_my_login_ms_signup;
  18.  
  19.     add_action( 'wp_head', 'wp_no_robots' );
  20.     add_action( 'wp_head', array( &$theme_my_login_ms_signup, 'signup_header' ) );
  21.  
  22.     if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
  23.         wp_redirect( network_home_url() );
  24.         exit;
  25.     }
  26. }
  27. add_action( 'tml_request_register', 'tml_request_register' );
  28.  
  29. /**
  30.  * Adds signup meta to register user to current blog
  31.  *
  32.  * @param array $meta Signup meta
  33.  */
  34. function tml_add_signup_meta( $meta ) {
  35.     global $current_blog;
  36.  
  37.     $meta['add_to_blog'] = $current_blog->blog_id;
  38.     $meta['new_role']    = 'subscriber';
  39.  
  40.     return $meta;
  41. }
  42. add_filter( 'add_signup_meta', 'tml_add_signup_meta' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement