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 = get_user_by( 'login', $user_login );
52 if ( ! $user->exists() )
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',
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 No alternative available. For performance reasons this function is not recommended.
146 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
147 _deprecated_function( __FUNCTION__, '3.0' );
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 No alternative available. For performance reasons this function is not recommended.
173 function get_most_active_blogs( $num = 10, $display = true ) {
174 _deprecated_function( __FUNCTION__, '3.0' );
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 );
205 * Redirect a user based on $_GET or $_POST arguments.
207 * The function looks for redirect arguments in the following order:
210 * 3) $_SERVER['HTTP_REFERER']
211 * 4) $_GET['redirect']
212 * 5) $_POST['redirect']
217 * @deprecated Use wp_redirect()
218 * @uses wpmu_admin_redirect_add_updated_param()
222 function wpmu_admin_do_redirect( $url = '' ) {
223 _deprecated_function( __FUNCTION__, '3.3' );
226 if ( isset( $_GET['ref'] ) )
228 if ( isset( $_POST['ref'] ) )
229 $ref = $_POST['ref'];
232 $ref = wpmu_admin_redirect_add_updated_param( $ref );
236 if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
237 wp_redirect( $_SERVER['HTTP_REFERER'] );
241 $url = wpmu_admin_redirect_add_updated_param( $url );
242 if ( isset( $_GET['redirect'] ) ) {
243 if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
244 $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
245 } elseif ( isset( $_POST['redirect'] ) ) {
246 $url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
253 * Adds an 'updated=true' argument to a URL.
257 * @deprecated Use add_query_arg()
262 function wpmu_admin_redirect_add_updated_param( $url = '' ) {
263 _deprecated_function( __FUNCTION__, '3.3' );
265 if ( strpos( $url, 'updated=true' ) === false ) {
266 if ( strpos( $url, '?' ) === false )
267 return $url . '?updated=true';
269 return $url . '&updated=true';