3 * Deprecated functions from WordPress MU and the multisite feature. You shouldn't
4 * use these functions and look for the alternatives instead. The functions will be
5 * removed in a later version.
8 * @subpackage Deprecated
13 * Deprecated functions come here to die.
19 * @deprecated Use wp_generate_password()
20 * @see wp_generate_password()
22 function generate_random_password( $len = 8 ) {
23 _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
24 return wp_generate_password( $len );
28 * Determine if user is a site admin.
30 * Plugins should use is_multisite() instead of checking if this function exists
31 * to determine if multisite is enabled.
33 * This function must reside in a file included only if is_multisite() due to
34 * legacy function_exists() checks to determine if multisite is enabled.
38 * @deprecated Use is_super_admin()
39 * @see is_super_admin()
43 function is_site_admin( $user_login = '' ) {
44 _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
46 if ( empty( $user_login ) ) {
47 $user_id = get_current_user_id();
51 $user = new WP_User( null, $user_login) ;
52 if ( empty( $user->id ) )
57 return is_super_admin( $user_id );
60 if ( !function_exists( 'graceful_fail' ) ) :
64 * @deprecated Use wp_die()
67 function graceful_fail( $message ) {
68 _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
69 $message = apply_filters( 'graceful_fail', $message );
70 $message_template = apply_filters( 'graceful_fail_template',
71 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
72 <html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
73 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
75 <style type="text/css">
80 line-height: 1.6em; font-family: Georgia, serif; width: 390px; margin: auto;
91 <p class="message">%s</p>
94 die( sprintf( $message_template, $message ) );
101 * @deprecated Use get_user_by()
104 function get_user_details( $username ) {
105 _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
106 return get_user_by('login', $username);
112 * @deprecated Use clean_post_cache()
113 * @see clean_post_cache()
115 function clear_global_post_cache( $post_id ) {
116 _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
122 * @deprecated Use is_main_site()
123 * @see is_main_site()
125 function is_main_blog() {
126 _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
127 return is_main_site();
133 * @deprecated Use is_email()
136 function validate_email( $email, $check_domain = true) {
137 _deprecated_function( __FUNCTION__, '3.0', 'is_email()' );
138 return is_email( $email, $check_domain );
144 * @deprecated Don't use this, really.
146 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
147 _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
150 $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
152 foreach ( (array) $blogs as $details ) {
153 $blog_list[ $details['blog_id'] ] = $details;
154 $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
159 if ( false == is_array( $blogs ) )
163 return array_slice( $blogs, $start, count( $blogs ) );
165 return array_slice( $blogs, $start, $num );
171 * @deprecated Don't use this, really.
173 function get_most_active_blogs( $num = 10, $display = true ) {
174 _deprecated_function( __FUNCTION__, '3.0', "Don't use this, really." );
176 $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
177 if ( is_array( $blogs ) ) {
179 foreach ( (array) $blogs as $key => $details ) {
180 $most_active[ $details['blog_id'] ] = $details['postcount'];
181 $blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!!
183 arsort( $most_active );
184 reset( $most_active );
185 foreach ( (array) $most_active as $key => $details )
186 $t[ $key ] = $blog_list[ $key ];
188 unset( $most_active );
192 if ( $display == true ) {
193 if ( is_array( $most_active ) ) {
194 reset( $most_active );
195 foreach ( (array) $most_active as $key => $details ) {
196 $url = esc_url('http://' . $details['domain'] . $details['path']);
197 echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
201 return array_slice( $most_active, 0, $num );