Want more features on Pastebin? Sign Up, it's FREE!
Guest

WordPress Multisite Signup at Sub-blog

By: a guest on Nov 30th, 2012  |  syntax: PHP  |  size: 1.27 KB  |  views: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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' );
clone this paste RAW Paste Data