* Gets the network's site and user counts.
*
* @since MU 1.0
- * @uses get_blog_count()
- * @uses get_user_count()
*
* @return array Site and user count for the network.
*/
* is returned.
*
* @since MU 1.0
- * @uses get_blogs_of_user()
- * @uses add_user_to_blog()
- * @uses get_blog_details()
*
* @param int $user_id The unique ID of the user
* @return object The blog object
if ( $reassign != '' ) {
$reassign = (int) $reassign;
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
+ $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
+ $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
+
+ if ( ! empty( $post_ids ) ) {
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
+ array_walk( $post_ids, 'clean_post_cache' );
+ }
+
+ if ( ! empty( $link_ids ) ) {
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
+ array_walk( $link_ids, 'clean_bookmark_cache' );
+ }
}
restore_current_blog();
* Create an empty blog.
*
* @since MU 1.0
- * @uses install_blog()
*
* @param string $domain The new blog's domain.
* @param string $path The new blog's path.
* relevant errors if necessary.
*
* @since MU
- * @uses is_email_address_unsafe()
- * @uses username_exists()
- * @uses email_exists()
*
* @param string $user_name The login name provided by the user.
* @param string $user_email The email provided by the user.
* the way that WordPress validates new site signups.
*
* @since MU
- * @uses domain_exists()
- * @uses username_exists()
*
* @param string $blogname The blog name provided by the user. Must be unique.
* @param string $blog_title The blog title provided by the user.
* Record site signup information for future activation.
*
* @since MU
- * @uses wpmu_signup_blog_notification()
*
* @param string $domain The requested domain.
* @param string $path The requested path.
* new site registration is not.
*
* @since MU
- * @uses wpmu_signup_user_notification()
*
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
$from_name,
esc_url( 'http://' . $domain . $path )
);
- wp_mail($user_email, $subject, $message, $message_headers);
+ wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
return true;
}
$from_name,
$user
);
- wp_mail($user_email, $subject, $message, $message_headers);
+ wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
return true;
}
* by a Super Admin).
*
* @since MU
- * @uses wp_generate_password()
- * @uses wpmu_welcome_user_notification()
- * @uses add_user_to_blog()
- * @uses wpmu_create_user()
- * @uses wpmu_create_blog()
- * @uses wpmu_welcome_notification()
*
* @param string $key The activation key provided to the user.
* @return array An array containing information about the activated user and/or blog
* use 'user_register').
*
* @since MU
- * @uses wp_create_user()
*
* @param string $user_name The new user's login name.
* @param string $password The new user's password.
* @param string $email The new user's email address.
- * @return mixed Returns false on failure, or int $user_id on success
+ * @return int|bool Returns false on failure, or int $user_id on success
*/
function wpmu_create_user( $user_name, $password, $email ) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
* root domain (eg 'blog1.example.com'), and $path is '/'.
*
* @since MU
- * @uses domain_exists()
- * @uses insert_blog()
- * @uses wp_install_defaults()
- * @uses add_user_to_blog()
*
* @param string $domain The new site's domain.
* @param string $path The new site's path.
* the notification email.
*
* @since MU
- * @uses apply_filters() Filter newuser_notify_siteadmin to change the content of the email message
*
* @param int $user_id The new user's ID.
* @return bool
*/
function domain_exists($domain, $path, $site_id = 1) {
global $wpdb;
+ $path = trailingslashit( $path );
$result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
+
/**
* Filter whether a blogname is taken.
*
* points to the new blog.
*
* @since MU
- * @uses make_db_current_silent()
- * @uses populate_roles()
*
* @param int $blog_id The value returned by insert_blog().
* @param string $blog_title The title of the new site.
make_db_current_silent( 'blog' );
populate_options();
populate_roles();
- $wp_roles->_init();
+
+ // populate_roles() clears previous role definitions so we start over.
+ $wp_roles = new WP_Roles();
$url = untrailingslashit( $url );
* @since MU
* @deprecated MU
* @deprecated Use wp_install_defaults()
- * @uses wp_install_defaults()
*
* @param int $blog_id Ignored in this function.
* @param int $user_id
BLOG_URL
You can log in to the administrator account with the following information:
+
Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php
* @param string $subject Subject of the email.
*/
$subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
- wp_mail($user->user_email, $subject, $message, $message_headers);
+ wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
return true;
}
* @param string $subject Subject of the email.
*/
$subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
- wp_mail($user->user_email, $subject, $message, $message_headers);
+ wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
return true;
}
* the most recent post_date_gmt.
*
* @since MU
- * @uses get_blogs_of_user()
*
* @param int $user_id
* @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
* a blog has exceeded its allowed upload space.
*
* @since MU
- * @uses recurse_dirsize()
*
* @param string $directory
* @return int
* @return array
*/
function check_upload_mimes( $mimes ) {
- $site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );
+ $site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
+ $site_mimes = array();
foreach ( $site_exts as $ext ) {
foreach ( $mimes as $ext_pattern => $mime ) {
if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
* WordPress MS stores a blog's post count as an option so as
* to avoid extraneous COUNTs when a blog's details are fetched
* with get_blog_details(). This function is called when posts
- * are published to make sure the count stays current.
+ * are published or unpublished to make sure the count stays current.
*
* @since MU
*/
* Add a nonce field to the signup page.
*
* @since MU
- * @uses wp_nonce_field()
*/
function signup_nonce_fields() {
$id = mt_rand();
* Process the signup nonce created in signup_nonce_fields().
*
* @since MU
- * @uses wp_create_nonce()
*
* @param array $result
* @return array
* added, as when a user is invited through the regular WP Add User interface.
*
* @since MU
- * @uses add_existing_user_to_blog()
*/
function maybe_add_existing_user_to_blog() {
if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
* Add a user to a blog based on details from maybe_add_existing_user_to_blog().
*
* @since MU
- * @uses add_user_to_blog()
*
* @param array $details
*/
* Check to see whether a user is marked as a spammer, based on user login.
*
* @since MU
- * @uses get_user_by()
*
* @param string|WP_User $user Optional. Defaults to current user. WP_User object,
* or user login name as a string.
* Public blogs have a setting of 1, private blogs are 0.
*
* @since MU
- * @uses update_blog_status()
*
* @param int $old_value
* @param int $value The new public value
- * @return bool
*/
function update_blog_public( $old_value, $value ) {
update_blog_status( get_current_blog_id(), 'public', (int) $value );
* Check whether a usermeta key has to do with the current blog.
*
* @since MU
- * @uses wp_get_current_user()
*
* @param string $key
* @param int $user_id Optional. Defaults to current user.
global $wpdb;
$current_user = wp_get_current_user();
- if ( $user_id == 0 )
- $user_id = $current_user->ID;
- if ( $blog_id == 0 )
+ if ( $blog_id == 0 ) {
$blog_id = $wpdb->blogid;
-
+ }
$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
if ( isset( $current_user->$local_key ) )
* on a network when a site is created or its status is updated.
*
* @since 3.7.0
- *
- * @uses wp_update_network_site_counts()
*/
function wp_maybe_update_network_site_counts() {
$is_small_network = ! wp_is_large_network( 'sites' );
* on a network when a user is created or its status is updated.
*
* @since 3.7.0
- *
- * @uses wp_update_network_user_counts()
*/
function wp_maybe_update_network_user_counts() {
$is_small_network = ! wp_is_large_network( 'users' );