Switch the multisite constant EDIT_ANY_USER to a filter. Also ensure we're back compat with POST_BY_EMAIL. see #12381

git-svn-id: http://svn.automattic.com/wordpress/trunk@13568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-03 07:04:25 +00:00
parent 8dee46ddf0
commit 8b87777391
3 changed files with 41 additions and 31 deletions

View File

@ -41,11 +41,6 @@ define('PATH_CURRENT_SITE', 'current_site_path' );
define('SITE_ID_CURRENT_SITE', 1);
define('BLOGID_CURRENT_SITE', '1' );
/* Uncomment to allow blog admins to edit their users. See http://trac.mu.wordpress.org/ticket/1169 */
//define( "EDIT_ANY_USER", true );
/* Uncomment to enable post by email options. See http://trac.mu.wordpress.org/ticket/1084 */
//define( "POST_BY_EMAIL", true );
/**#@+
* Authentication Unique Keys.
*

View File

@ -61,8 +61,8 @@ function use_ssl_preference($user) {
}
// Only allow site admins to edit every user.
if ( is_multisite() && !defined( "EDIT_ANY_USER" ) && !is_super_admin() && $user_id != $current_user->ID )
// Only allow super admins on multisite to edit every user.
if ( is_multisite() && ! is_super_admin() && $user_id != $current_user->ID && apply_filters( 'enable_edit_any_user_configuration', true ) )
wp_die( __( 'You do not have permission to edit this user.' ) );
// Execute confirmed email change. See send_confirmation_on_profile_email().

View File

@ -1,43 +1,58 @@
<?php
/**
* Sets up the default filters and actions for Multisite.
*
* If you need to remove a default hook, this file will give you the priority
* for which to use to remove the hook.
*
* Not all of the Multisite default hooks are found in ms-default-filters.php
*
* @package WordPress
* @subpackage Multisite
* @see default-filters.php
*/
// Users
add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' );
add_action ( 'init', 'maybe_add_existing_user_to_blog' );
add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
add_action ( 'sanitize_user', 'strtolower' );
add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
add_action( 'init', 'maybe_add_existing_user_to_blog' );
add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
add_action( 'sanitize_user', 'strtolower' );
// Blogs
add_filter ( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
add_action ( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
add_action ( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
// Register Nonce
add_action ( 'signup_hidden_fields', 'signup_nonce_fields' );
add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
// Template
add_action ( 'template_redirect', 'maybe_redirect_404' );
add_filter ( 'allowed_redirect_hosts', 'redirect_this_site' );
add_action( 'template_redirect', 'maybe_redirect_404' );
add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
// Administration
add_filter ( 'term_id_filter', 'global_terms', 10, 2 );
add_action ( 'publish_post', 'update_posts_count' );
add_action ( 'delete_post', 'wpmu_update_blogs_date' );
add_action ( 'private_to_published', 'wpmu_update_blogs_date' );
add_action ( 'publish_phone', 'wpmu_update_blogs_date' );
add_action ( 'publish_post', 'wpmu_update_blogs_date' );
add_filter( 'term_id_filter', 'global_terms', 10, 2 );
add_action( 'publish_post', 'update_posts_count' );
add_action( 'delete_post', 'wpmu_update_blogs_date' );
add_action( 'private_to_published', 'wpmu_update_blogs_date' );
add_action( 'publish_phone', 'wpmu_update_blogs_date' );
add_action( 'publish_post', 'wpmu_update_blogs_date' );
// Files
add_filter ( 'wp_upload_bits', 'upload_is_file_too_big' );
add_filter ( 'import_upload_size_limit', 'fix_import_form_size' );
add_filter ( 'upload_mimes', 'check_upload_mimes' );
add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
add_filter( 'upload_mimes', 'check_upload_mimes' );
add_action( 'admin_notices', 'ms_deprecated_blogs_file' );
// Mail
add_filter ( 'wp_mail_from', 'wordpressmu_wp_mail_from' );
add_filter( 'wp_mail_from', 'wordpressmu_wp_mail_from' );
add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
// Disable somethings by default for multisite
add_filter( 'enable_update_services_configuration', '__return_false' );
add_filter( 'enable_post_by_email_configuration', '__return_false' );
if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
add_filter( 'enable_post_by_email_configuration', '__return_false' );
if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
add_filter( 'enable_edit_any_user_configuration', '__return_false' );
?>