Changeset 47122 for trunk/src/wp-includes/ms-functions.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/ms-functions.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-functions.php
r47109 r47122 63 63 } 64 64 } else { 65 // TODOReview this call to add_user_to_blog too - to get here the user must have a role on this blog?65 // TODO: Review this call to add_user_to_blog too - to get here the user must have a role on this blog? 66 66 $result = add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' ); 67 67 … … 73 73 74 74 if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) { 75 $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.75 $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs. 76 76 $ret = false; 77 77 if ( is_array( $blogs ) && count( $blogs ) > 0 ) { … … 274 274 } 275 275 276 // wp_revoke_user( $user_id);276 // wp_revoke_user( $user_id ); 277 277 $user = get_userdata( $user_id ); 278 278 if ( ! $user ) { … … 348 348 $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); 349 349 350 if ( $id == -1 ) { // blog does not exist350 if ( $id == -1 ) { // Blog does not exist. 351 351 return 0; 352 352 } elseif ( $id ) { … … 374 374 } 375 375 376 // Admin functions 376 // 377 // Admin functions. 378 // 377 379 378 380 /** … … 508 510 } 509 511 510 // all numeric?512 // All numeric? 511 513 if ( preg_match( '/^[0-9]*$/', $user_name ) ) { 512 514 $errors->add( 'user_name', __( 'Sorry, usernames must have letters too!' ) ); … … 666 668 } 667 669 668 // do not allow users to create a blog that conflicts with a page on the main blog.670 // Do not allow users to create a blog that conflicts with a page on the main blog. 669 671 if ( ! is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( 'SELECT post_name FROM ' . $wpdb->get_blog_prefix( $current_network->site_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) { 670 672 $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) ); 671 673 } 672 674 673 // all numeric?675 // All numeric? 674 676 if ( preg_match( '/^[0-9]*$/', $blogname ) ) { 675 677 $errors->add( 'blogname', __( 'Sorry, site names must have letters too!' ) ); … … 713 715 714 716 // Has someone already signed up for this domain? 715 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) ); // TODO: Check email too? 717 // TODO: Check email too? 718 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) ); 716 719 if ( ! empty( $signup ) ) { 717 720 $diff = time() - mysql2date( 'U', $signup->registered ); … … 841 844 global $wpdb; 842 845 843 // Format data 846 // Format data. 844 847 $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) ); 845 848 $user_email = sanitize_email( $user_email ); … … 934 937 $activate_url = network_site_url( "wp-activate.php?key=$key" ); 935 938 } else { 936 $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API939 $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API. 937 940 } 938 941 … … 1213 1216 // TODO: What to do if we create a user but cannot create a blog? 1214 1217 if ( is_wp_error( $blog_id ) ) { 1215 // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and 1216 // setting the activation flag. Let's just set the active flag and instruct the user to reset their password. 1218 /* 1219 * If blog is taken, that means a previous attempt to activate this blog 1220 * failed in between creating the blog and setting the activation flag. 1221 * Let's just set the active flag and instruct the user to reset their password. 1222 */ 1217 1223 if ( 'blog_taken' == $blog_id->get_error_code() ) { 1218 1224 $blog_id->add_data( $signup ); … … 1789 1795 1790 1796 // Walk through each blog and get the most recent post 1791 // published by $user_id 1797 // published by $user_id. 1792 1798 foreach ( (array) $user_blogs as $blog ) { 1793 1799 $prefix = $wpdb->get_blog_prefix( $blog->userblog_id ); 1794 1800 $recent_post = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A ); 1795 1801 1796 // Make sure we found a post 1802 // Make sure we found a post. 1797 1803 if ( isset( $recent_post['ID'] ) ) { 1798 1804 $post_gmt_ts = strtotime( $recent_post['post_date_gmt'] ); 1799 1805 1800 // If this is the first post checked or if this post is 1801 // newer than the current recent post, make it the new 1802 // most recent post. 1806 /* 1807 * If this is the first post checked 1808 * or if this post is newer than the current recent post, 1809 * make it the new most recent post. 1810 */ 1803 1811 if ( ! isset( $most_recent_post['post_gmt_ts'] ) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) { 1804 1812 $most_recent_post = array( … … 1815 1823 } 1816 1824 1817 // Misc functions 1825 // 1826 // Misc functions. 1827 // 1818 1828 1819 1829 /** … … 1921 1931 } 1922 1932 1923 // prevent a race condition1933 // Prevent a race condition. 1924 1934 $recurse_start = false; 1925 1935 if ( $global_terms_recurse === null ) { … … 2183 2193 $blog_id = $meta['add_to_blog']; 2184 2194 $role = $meta['new_role']; 2185 remove_user_from_blog( $user_id, get_network()->site_id ); // remove user from main blog.2195 remove_user_from_blog( $user_id, get_network()->site_id ); // Remove user from main blog. 2186 2196 2187 2197 $result = add_user_to_blog( $blog_id, $user_id, $role ); … … 2317 2327 function filter_SSL( $url ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 2318 2328 if ( ! is_string( $url ) ) { 2319 return get_bloginfo( 'url' ); // Return home blog url with proper scheme2329 return get_bloginfo( 'url' ); // Return home blog URL with proper scheme. 2320 2330 } 2321 2331 … … 2779 2789 'headers' => '', 2780 2790 ); 2781 // get network name2791 // Get network name. 2782 2792 $network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES ); 2783 2793
Note: See TracChangeset
for help on using the changeset viewer.