~canonical-sysadmins/wordpress/4.2.4

« back to all changes in this revision

Viewing changes to wp-includes/ms-functions.php

  • Committer: Paul Gear
  • Date: 2015-04-24 01:35:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: paul.gear@canonical.com-20150424013520-w4p9ksth76zh6opw
Merge new upstream release 4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
434
434
}
435
435
 
436
436
/**
437
 
 * Processes new user registrations.
438
 
 *
439
 
 * Checks the data provided by the user during signup. Verifies
440
 
 * the validity and uniqueness of user names and user email addresses,
441
 
 * and checks email addresses against admin-provided domain
442
 
 * whitelists and blacklists.
443
 
 *
444
 
 * The hook 'wpmu_validate_user_signup' provides an easy way
445
 
 * to modify the signup process. The value $result, which is passed
446
 
 * to the hook, contains both the user-provided info and the error
447
 
 * messages created by the function. 'wpmu_validate_user_signup' allows
448
 
 * you to process the data in any way you'd like, and unset the
449
 
 * relevant errors if necessary.
 
437
 * Sanitize and validate data required for a user sign-up.
 
438
 *
 
439
 * Verifies the validity and uniqueness of user names and user email addresses,
 
440
 * and checks email addresses against admin-provided domain whitelists and blacklists.
 
441
 *
 
442
 * The {@see 'wpmu_validate_user_signup'} hook provides an easy way to modify the sign-up
 
443
 * process. The value $result, which is passed to the hook, contains both the user-provided
 
444
 * info and the error messages created by the function. {@see 'wpmu_validate_user_signup'}
 
445
 * allows you to process the data in any way you'd like, and unset the relevant errors if
 
446
 * necessary.
450
447
 *
451
448
 * @since MU
452
449
 *
453
 
 * @param string $user_name The login name provided by the user.
 
450
 * @param string $user_name  The login name provided by the user.
454
451
 * @param string $user_email The email provided by the user.
455
452
 * @return array Contains username, email, and error messages.
456
453
 */
1437
1434
 
1438
1435
        $welcome_email = get_site_option( 'welcome_email' );
1439
1436
        if ( $welcome_email == false )
1440
 
                $welcome_email = __( 'Dear User,
 
1437
                $welcome_email = __( 'Howdy USERNAME,
1441
1438
 
1442
1439
Your new SITE_NAME site has been successfully set up at:
1443
1440
BLOG_URL
1804
1801
                        $global_id = $wpdb->insert_id;
1805
1802
                }
1806
1803
        } elseif ( $global_id != $term_id ) {
1807
 
                $local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
1808
 
                if ( null != $local_id )
1809
 
                        $local_id = global_terms( $local_id );
1810
 
                        if ( 10 < $global_terms_recurse )
 
1804
                $local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
 
1805
                if ( null != $local_id ) {
 
1806
                        global_terms( $local_id );
 
1807
                        if ( 10 < $global_terms_recurse ) {
1811
1808
                                $global_id = $term_id;
 
1809
                        }
 
1810
                }
1812
1811
        }
1813
1812
 
1814
1813
        if ( $global_id != $term_id ) {
1935
1934
        if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
1936
1935
                wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
1937
1936
 
1938
 
        wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ) );
 
1937
        wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ), array( 'response' => 200 ) );
1939
1938
}
1940
1939
 
1941
1940
/**
2005
2004
 * @return bool
2006
2005
 */
2007
2006
function is_user_spammy( $user = null ) {
2008
 
    if ( ! is_a( $user, 'WP_User' ) ) {
2009
 
                if ( $user )
 
2007
    if ( ! ( $user instanceof WP_User ) ) {
 
2008
                if ( $user ) {
2010
2009
                        $user = get_user_by( 'login', $user );
2011
 
                else
 
2010
                } else {
2012
2011
                        $user = wp_get_current_user();
 
2012
                }
2013
2013
        }
2014
2014
 
2015
2015
        return $user && isset( $user->spam ) && 1 == $user->spam;
2028
2028
function update_blog_public( $old_value, $value ) {
2029
2029
        update_blog_status( get_current_blog_id(), 'public', (int) $value );
2030
2030
}
2031
 
add_action('update_option_blog_public', 'update_blog_public', 10, 2);
2032
2031
 
2033
2032
/**
2034
2033
 * Check whether a usermeta key has to do with the current blog.
2069
2068
 
2070
2069
        return false;
2071
2070
}
2072
 
add_filter('option_users_can_register', 'users_can_register_signup_filter');
2073
2071
 
2074
2072
/**
2075
2073
 * Ensure that the welcome message is not empty. Currently unused.
2082
2080
function welcome_user_msg_filter( $text ) {
2083
2081
        if ( !$text ) {
2084
2082
                remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
2085
 
                $text = __( 'Dear User,
 
2083
                $text = __( 'Howdy USERNAME,
2086
2084
 
2087
2085
Your new account is set up.
2088
2086
 
2098
2096
        }
2099
2097
        return $text;
2100
2098
}
2101
 
add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
2102
2099
 
2103
2100
/**
2104
2101
 * Whether to force SSL on content.