Ticket #30483: 30483.3.diff
File 30483.3.diff, 9.5 KB (added by , 10 years ago) |
---|
-
wp-admin/includes/ms.php
48 48 * 49 49 * @since 3.0.0 50 50 * 51 * @param int $blog_id Blog ID52 * @param bool $drop True if blog's table should be dropped. Default is false.51 * @param int $blog_id Blog ID 52 * @param bool $drop True if blog's table should be dropped. Default is false. 53 53 * @return void 54 54 */ 55 55 function wpmu_delete_blog( $blog_id, $drop = false ) { … … 169 169 restore_current_blog(); 170 170 } 171 171 172 // @todo Merge with wp_delete_user() ? 172 /** 173 * Delete a user from the network and remove from all sites. 174 * 175 * @since 3.0.0 176 * @todo Merge with wp_delete_user() ? 177 * 178 * @param int $id The ID of the user. 179 * @return bool True if the user was deleted, otherwise false. 180 */ 173 181 function wpmu_delete_user( $id ) { 174 182 global $wpdb; 175 183 … … 225 233 return true; 226 234 } 227 235 236 /** 237 * Sends an email when a site administrator email address is changed. 238 * 239 * @since 3.0.0 240 * 241 * @param string $old_value The old email address. Not currently used. 242 * @param string $value The new email address. 243 */ 228 244 function update_option_new_admin_email( $old_value, $value ) { 229 245 if ( $value == get_option( 'admin_email' ) || !is_email( $value ) ) 230 246 return; … … 278 294 add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); 279 295 add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); 280 296 297 /** 298 * Sends an email when an email address change is requested. 299 * 300 * @since 3.0.0 301 * 302 * @global object $errors WP_Error object. 303 * @global object $wpdb WordPress database object. 304 */ 281 305 function send_confirmation_on_profile_email() { 282 306 global $errors, $wpdb; 283 307 $current_user = wp_get_current_user(); … … 348 372 } 349 373 add_action( 'personal_options_update', 'send_confirmation_on_profile_email' ); 350 374 375 /** 376 * Adds an admin notice alterting the user to check for confirmation email after email address change. 377 * 378 * @since 3.0.0 379 */ 351 380 function new_user_email_admin_notice() { 352 381 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) ) 353 382 echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>"; … … 360 389 * @since MU 361 390 * 362 391 * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true. 363 * @return int392 * @return bool True if user is over upload space quota, otherwise false. 364 393 */ 365 394 function upload_is_user_over_quota( $echo = true ) { 366 395 if ( get_site_option( 'upload_space_check_disabled' ) ) … … 422 451 return min( $size, $available ); 423 452 } 424 453 425 // Edit blog upload space setting on Edit Blog page 454 /** 455 * Displays the edit blog upload space setting form on Edit Blog page. 456 * 457 * @since 3.0.0 458 * 459 * @param int $id The ID of the blog to display the setting for. 460 */ 426 461 function upload_space_setting( $id ) { 427 462 switch_to_blog( $id ); 428 463 $quota = get_option( 'blog_upload_space' ); … … 440 475 } 441 476 add_action( 'wpmueditblogaction', 'upload_space_setting' ); 442 477 478 /** 479 * Update the status of a user in the database. 480 * 481 * Used in core to mark a user as spam or "ham" (not spam) on multisite installs. 482 * 483 * @since 3.0.0 484 * 485 * @param int $id The ID of the user. 486 * @param string $pref The column in the wp_users table to update the user's status in (presumably 487 * user_status, spam, or deleted). 488 * @param int $value The new status for the user. 489 * @param null $deprecated Deprecated as of 3.0.2 and should not be used. 490 * @return int The initially passed $value. 491 */ 443 492 function update_user_status( $id, $pref, $value, $deprecated = null ) { 444 493 global $wpdb; 445 494 … … 476 525 return $value; 477 526 } 478 527 528 /** 529 * Cleans the user cache for a specific user. 530 * 531 * @since 3.0.0 532 * 533 * @param int $id The user ID. 534 * @return bool|int The ID of the refreshed user or false if user does not exist. 535 */ 479 536 function refresh_user_details( $id ) { 480 537 $id = (int) $id; 481 538 … … 487 544 return $id; 488 545 } 489 546 547 /** 548 * Returns the language for a language code. 549 * 550 * @since 3.0.0 551 * 552 * @param string $code Optional. The two-letter language code. 553 * @return string The language corresponding to $code if it exists. If it does not exist, then the first 554 * two letters of $code is returned. 555 */ 490 556 function format_code_lang( $code = '' ) { 491 557 $code = strtolower( substr( $code, 0, 2 ) ); 492 558 $lang_codes = array( … … 514 580 return strtr( $code, $lang_codes ); 515 581 } 516 582 583 /** 584 * Synchronize category and post tag slugs when global terms are enabled. 585 * 586 * @since 3.0.0 587 * 588 * @param $term The term. 589 * @param $taxonomy The taxonomy for $term. Should be 'category' or 'post_tag', as these are the only 590 * taxonomies which are processed by this function; anything else will be returned untouched. 591 * @return object|array Returns $term, after filtering the 'slug' field with sanitize_title() if $taxonomy 592 * is 'category' or 'post_tag'. 593 */ 517 594 function sync_category_tag_slugs( $term, $taxonomy ) { 518 595 if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) { 519 596 if ( is_object( $term ) ) { … … 526 603 } 527 604 add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); 528 605 606 /** 607 * Displays an access denied message when a user tries to view a site's dashboard they do not have access to. 608 * 609 * @since 3.2.0 610 * @access private 611 */ 529 612 function _access_denied_splash() { 530 613 if ( ! is_user_logged_in() || is_network_admin() ) 531 614 return; … … 560 643 } 561 644 add_action( 'admin_page_access_denied', '_access_denied_splash', 99 ); 562 645 646 /** 647 * Checks if the current user has permissions to import new users. 648 * 649 * @since 3.0.0 650 * 651 * @param string $permission A permission to be checked. Currently not used. 652 * @return bool True if the user has proper permissions, false if they do not. 653 */ 563 654 function check_import_new_users( $permission ) { 564 655 if ( !is_super_admin() ) 565 656 return false; … … 568 659 add_filter( 'import_allow_create_users', 'check_import_new_users' ); 569 660 // See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too. 570 661 662 /** 663 * Display a dropdown of available languages. 664 * 665 * @since 3.0.0 666 * 667 * @param array $lang_files An array of the language files. 668 * @param string $current The current language code. 669 */ 571 670 function mu_dropdown_languages( $lang_files = array(), $current = '' ) { 572 671 $flag = false; 573 672 $output = array(); … … 608 707 echo implode( "\n\t", $output ); 609 708 } 610 709 710 /** 711 * Displays an admin notice to upgrade all sites after a WordPress Core Upgrade. 712 * 713 * @since 3.0.0 714 * 715 * $global int The version number of the database. 716 */ 611 717 function site_admin_notice() { 612 718 global $wp_db_version; 613 719 if ( !is_super_admin() ) … … 618 724 add_action( 'admin_notices', 'site_admin_notice' ); 619 725 add_action( 'network_admin_notices', 'site_admin_notice' ); 620 726 727 /** 728 * Avoids a collision between a site slug and a permalink slug. 729 * 730 * In a subdirectory install this will make sure that a site and a post do not use the same subdirectory by checking 731 * for a site with the same name as a new post. 732 * 733 * @since 3.0.0 734 * 735 * @param array $data An array of post data. 736 * @param array $postarr An array of posts. Not currently used. 737 * @return array The new array of post data after checking for collisions. 738 */ 621 739 function avoid_blog_page_permalink_collision( $data, $postarr ) { 622 740 if ( is_subdomain_install() ) 623 741 return $data; … … 641 759 } 642 760 add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 ); 643 761 762 /** 763 * Handles the display of choosing a users primary site. 764 * 765 * This displays the user's primary site and allows the user to choose which site is primary. 766 * Used in wp-admin/my-sites.php. 767 * 768 * @since 3.0.0 769 */ 644 770 function choose_primary_blog() { 645 771 ?> 646 772 <table class="form-table"> … … 696 822 * Grants Super Admin privileges. 697 823 * 698 824 * @since 3.0.0 825 * 699 826 * @param int $user_id ID of the user to be granted Super Admin privileges. 700 827 * @return bool True on success, false on failure. This can fail when the user is 701 828 * already a super admin or when the $super_admins global is defined. … … 740 867 * Revokes Super Admin privileges. 741 868 * 742 869 * @since 3.0.0 870 * 743 871 * @param int $user_id ID of the user Super Admin privileges to be revoked from. 744 872 * @return bool True on success, false on failure. This can fail when the user's email 745 873 * is the network admin email or when the $super_admins global is defined. … … 783 911 } 784 912 785 913 /** 786 * Whether or not we can edit this network from this page 914 * Whether or not we can edit this network from this page. 787 915 * 788 * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden 916 * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden. 789 917 * 790 918 * @since 3.1.0 791 * @param integer $site_id The network/site ID to check. 919 * 920 * @param int $site_id The network/site ID to check. 921 * @return bool True if network can be edited, otherwise false. 792 922 */ 793 923 function can_edit_network( $site_id ) { 794 924 global $wpdb; … … 813 943 * Thickbox image paths for Network Admin. 814 944 * 815 945 * @since 3.1.0 946 * 816 947 * @access private 817 948 */ 818 949 function _thickbox_path_admin_subfolder() {