Changes from branches/3.0/wp-admin/includes/ms.php at r15452 to trunk/wp-admin/includes/ms.php at r17228
- File:
-
- 1 edited
-
trunk/wp-admin/includes/ms.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ms.php
r15452 r17228 66 66 do_action( 'delete_blog', $blog_id, $drop ); 67 67 68 $users = get_users _of_blog( $blog_id);68 $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) ); 69 69 70 70 // Remove users from this blog. 71 71 if ( ! empty( $users ) ) { 72 foreach ( $users as $user ) {73 remove_user_from_blog( $user ->user_id, $blog_id) ;72 foreach ( $users as $user_id ) { 73 remove_user_from_blog( $user_id, $blog_id) ; 74 74 } 75 75 } … … 175 175 do_action( 'deleted_user', $id ); 176 176 177 return true;178 }179 180 function confirm_delete_users( $users ) {181 $current_user = wp_get_current_user();182 if ( !is_array( $users ) )183 return false;184 185 screen_icon();186 ?>187 <h2><?php esc_html_e( 'Users' ); ?></h2>188 <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>189 <form action="ms-edit.php?action=dodelete" method="post">190 <input type="hidden" name="dodelete" />191 <?php192 wp_nonce_field( 'ms-users-delete' );193 $site_admins = get_super_admins();194 $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";195 196 foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {197 if ( $val != '' && $val != '0' ) {198 $delete_user = new WP_User( $val );199 200 if ( in_array( $delete_user->user_login, $site_admins ) )201 wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );202 203 echo "<input type='hidden' name='user[]' value='{$val}'/>\n";204 $blogs = get_blogs_of_user( $val, true );205 206 if ( !empty( $blogs ) ) {207 ?>208 <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>209 <?php210 foreach ( (array) $blogs as $key => $details ) {211 $blog_users = get_users_of_blog( $details->userblog_id );212 if ( is_array( $blog_users ) && !empty( $blog_users ) ) {213 $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";214 $user_dropdown = "<select name='blog[$val][{$key}]'>";215 $user_list = '';216 foreach ( $blog_users as $user ) {217 if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )218 $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";219 }220 if ( '' == $user_list )221 $user_list = $admin_out;222 $user_dropdown .= $user_list;223 $user_dropdown .= "</select>\n";224 ?>225 <ul style="list-style:none;">226 <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>227 <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />228 <?php _e( 'Delete all posts and links.' ); ?></label></li>229 <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />230 <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>231 </ul>232 <?php233 }234 }235 echo "</fieldset>";236 }237 }238 }239 ?>240 <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>241 </form>242 <?php243 177 return true; 244 178 } … … 407 341 } 408 342 409 /* 343 /** 410 344 * @since 3.0.0 411 345 * … … 414 348 function upload_size_limit_filter( $size ) { 415 349 $fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 ); 350 if ( get_site_option( 'upload_space_check_disabled' ) ) 351 return min( $size, $fileupload_maxk ); 352 416 353 return min( $size, $fileupload_maxk, get_upload_space_available() ); 417 354 } … … 484 421 } 485 422 486 // Display File upload quota on dashboard487 function dashboard_quota() {488 if ( get_site_option( 'upload_space_check_disabled' ) )489 return true;490 491 $quota = get_space_allowed();492 $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;493 494 if ( $used > $quota )495 $percentused = '100';496 else497 $percentused = ( $used / $quota ) * 100;498 $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';499 $used = round( $used, 2 );500 $percentused = number_format( $percentused );501 502 ?>503 <p class="sub musub"><?php _e( 'Storage Space' ); ?></p>504 <div class="table table_content musubtable">505 <table>506 <tr class="first">507 <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?></td>508 <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>509 </tr>510 </table>511 </div>512 <div class="table table_discussion musubtable">513 <table>514 <tr class="first">515 <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), esc_url( admin_url( 'upload.php' ) ), $used, $percentused ); ?></td>516 <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>517 </tr>518 </table>519 </div>520 <br class="clear" />521 <?php522 }523 if ( current_user_can( 'edit_posts' ) )524 add_action( 'activity_box_end', 'dashboard_quota' );525 526 423 // Edit blog upload space setting on Edit Blog page 527 424 function upload_space_setting( $id ) { … … 539 436 add_action( 'wpmueditblogaction', 'upload_space_setting' ); 540 437 541 function update_user_status( $id, $pref, $value, $ refresh = 1) {438 function update_user_status( $id, $pref, $value, $deprecated = null ) { 542 439 global $wpdb; 543 440 441 if ( null !== $deprecated ) 442 _deprecated_argument( __FUNCTION__, '3.1' ); 443 544 444 $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) ); 545 445 546 if ( $refresh == 1 ) 547 refresh_user_details( $id ); 446 clean_user_cache( $id ); 548 447 549 448 if ( $pref == 'spam' ) { … … 609 508 610 509 $blog = get_active_blog_for_user( get_current_user_id() ); 611 $dashboard_blog = get_dashboard_blog(); 510 612 511 if ( is_object( $blog ) ) { 613 512 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case" 614 exit; 615 } 616 617 /* 618 If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog, 619 then update the primary_blog record to match the user's blog 620 */ 621 $blogs = get_blogs_of_user( get_current_user_id() ); 622 623 if ( !empty( $blogs ) ) { 624 foreach( $blogs as $blogid => $blog ) { 625 if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) { 626 update_user_meta( get_current_user_id(), 'primary_blog', $blogid ); 627 continue; 628 } 629 } 630 $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) ); 631 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); 632 exit; 633 } 634 wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 513 } else { 514 wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case" 515 } 516 exit; 635 517 } 636 518 add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 ); … … 694 576 } 695 577 } 696 add_action( 'admin_notices', 'secret_salt_warning' ); 697 698 function admin_notice_feed() { 699 global $current_screen; 700 if ( $current_screen->id != 'dashboard' ) 701 return; 702 703 if ( !empty( $_GET['feed_dismiss'] ) ) { 704 update_user_option( get_current_user_id(), 'admin_feed_dismiss', $_GET['feed_dismiss'], true ); 705 return; 706 } 707 708 $url = get_site_option( 'admin_notice_feed' ); 709 if ( empty( $url ) ) 710 return; 711 712 $rss = fetch_feed( $url ); 713 if ( ! is_wp_error( $rss ) && $item = $rss->get_item() ) { 714 $title = $item->get_title(); 715 if ( md5( $title ) == get_user_option( 'admin_feed_dismiss' ) ) 716 return; 717 $msg = "<h3>" . esc_html( $title ) . "</h3>\n"; 718 $content = $item->get_description(); 719 $content = $content ? wp_html_excerpt( $content, 200 ) . ' … ' : ''; 720 $link = esc_url( strip_tags( $item->get_link() ) ); 721 $msg .= "<p>" . $content . "<a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $title ) . "'>" . __( 'Dismiss' ) . "</a></p>"; 722 echo "<div class='updated'>$msg</div>"; 723 } elseif ( is_super_admin() ) { 724 printf( '<div class="update-nag">' . __( 'Your feed at %s is empty.' ) . '</div>', esc_html( $url ) ); 725 } 726 } 727 add_action( 'admin_notices', 'admin_notice_feed' ); 578 add_action( 'network_admin_notices', 'secret_salt_warning' ); 728 579 729 580 function site_admin_notice() { … … 732 583 return false; 733 584 if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) 734 echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "</div>";585 echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Update Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>"; 735 586 } 736 587 add_action( 'admin_notices', 'site_admin_notice' ); 588 add_action( 'network_admin_notices', 'site_admin_notice' ); 737 589 738 590 function avoid_blog_page_permalink_collision( $data, $postarr ) { … … 806 658 } 807 659 808 function show_post_thumbnail_warning() {809 if ( ! is_super_admin() )810 return;811 $mu_media_buttons = get_site_option( 'mu_media_buttons', array() );812 if ( empty($mu_media_buttons['image']) && current_theme_supports( 'post-thumbnails' ) ) {813 echo "<div class='update-nag'>" . sprintf( __( "Warning! The current theme supports Featured Images. You must enable image uploads on <a href='%s'>the options page</a> for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "</div>";814 }815 }816 add_action( 'admin_notices', 'show_post_thumbnail_warning' );817 818 660 function ms_deprecated_blogs_file() { 819 661 if ( ! is_super_admin() ) … … 823 665 echo '<div class="update-nag">' . sprintf( __( 'The <code>%1$s</code> file is deprecated. Please remove it and update your server rewrite rules to use <code>%2$s</code> instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . '</div>'; 824 666 } 825 add_action( ' admin_notices', 'ms_deprecated_blogs_file' );826 827 /** 828 * Outputs the notice message for multisite regarding activation of plugin page.667 add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' ); 668 669 /** 670 * Grants super admin privileges. 829 671 * 830 672 * @since 3.0.0 831 * @return none 832 */ 833 function _admin_notice_multisite_activate_plugins_page() { 834 $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '<a href="' . esc_url( admin_url( 'ms-options.php#menu' ) ) . '">' . __( 'Activate' ) . '</a>' ); 835 echo "<div class='error'><p>$message</p></div>"; 836 } 837 838 /** 839 * Grants super admin privileges. 840 * 841 * @since 3.0.0 842 * @param $user_id 673 * @param int $user_id 843 674 */ 844 675 function grant_super_admin( $user_id ) { … … 868 699 * 869 700 * @since 3.0.0 870 * @param $user_id701 * @param int $user_id 871 702 */ 872 703 function revoke_super_admin( $user_id ) { … … 893 724 return false; 894 725 } 726 727 /** 728 * Whether or not we can edit this network from this page 729 * 730 * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden 731 * 732 * @since 3.1.0 733 * @param integer $site_id The network/site id to check. 734 */ 735 function can_edit_network( $site_id ) { 736 global $wpdb; 737 738 if ($site_id == $wpdb->siteid ) 739 $result = true; 740 else 741 $result = false; 742 743 return apply_filters( 'can_edit_network', $result, $site_id ); 744 } 745 746 /** 747 * Thickbox image paths for Network Admin. 748 * 749 * @since 3.1.0 750 * @access private 751 */ 752 function _thickbox_path_admin_subfolder() { 895 753 ?> 754 <script type="text/javascript"> 755 //<![CDATA[ 756 var tb_pathToImage = "../../wp-includes/js/thickbox/loadingAnimation.gif"; 757 var tb_closeImage = "../../wp-includes/js/thickbox/tb-close.png"; 758 //]]> 759 </script> 760 <?php 761 } 762 763 ?>
Note: See TracChangeset
for help on using the changeset viewer.