Changeset 1377
- Timestamp:
- 07/16/08 14:06:33 (5 months ago)
- Files:
-
- trunk/wp-config-sample.php (modified) (1 diff)
- trunk/wp-includes/wpmu-functions.php (modified) (2 diffs)
- trunk/wpmu-settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-config-sample.php
r1350 r1377 36 36 //define( 'SUNRISE', 'on' ); 37 37 38 // Uncomment and set this to a URL to redirect if a blog does not exist . (Useful if signup is disabled)39 // Browser will redirect to constant( 'NOBLOGREDICT' ) . "?new=blogname" where blogname is the unknown blog38 // Uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled) 39 // For example, browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' ); 40 40 // define( 'NOBLOGREDIRECT', '' ); 41 41 trunk/wp-includes/wpmu-functions.php
r1375 r1377 99 99 global $wpdb; 100 100 return $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" ); 101 } 102 103 function is_main_blog() { 104 global $current_blog, $current_site; 105 if( $current_blog->domain == $current_site->domain && $current_blog->path == $current_site->path ) 106 return true; 107 return false; 101 108 } 102 109 … … 1962 1969 add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' ); 1963 1970 add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' ); 1971 1972 function maybe_redirect_404() { 1973 global $wpdb; 1974 if( is_main_blog() && is_404() && defined( 'NOBLOGREDIRECT' ) && constant( 'NOBLOGREDIRECT' ) != '' ) { 1975 header( "Location: " . constant( 'NOBLOGREDIRECT' ) ); 1976 die(); 1977 } 1978 } 1979 add_action( 'template_redirect', 'maybe_redirect_404' ); 1964 1980 ?> trunk/wpmu-settings.php
r1373 r1377 104 104 if( defined( "WP_INSTALLING" ) == false ) { 105 105 if( $current_site && $current_blog == null ) { 106 if( defined( 'NOBLOGREDIRECT' ) && constant( 'NOBLOGREDIRECT' ) != '' ) { 107 header( "Location: " . constant( 'NOBLOGREDIRECT' ) . "?new=" . urlencode( $blogname ) ); 108 } else { 109 header( "Location: http://{$current_site->domain}{$current_site->path}wp-signup.php?new=" . urlencode( $blogname ) ); 110 } 111 die(); 106 $current_blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE domain = '{$current_site->domain}' AND path = '{$current_site->path}'"); 112 107 } 113 108 if( $current_blog == false || $current_site == false )
