2010-01-06 05:02:57 +01:00
|
|
|
<?php
|
2010-03-03 08:04:25 +01:00
|
|
|
/**
|
|
|
|
* 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
|
2010-04-04 15:29:35 +02:00
|
|
|
* @since 3.0.0
|
2010-03-03 08:04:25 +01:00
|
|
|
*/
|
|
|
|
|
2010-01-06 05:02:57 +01:00
|
|
|
// Users
|
2010-03-03 08:04:25 +01:00
|
|
|
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 );
|
2013-09-25 05:14:09 +02:00
|
|
|
add_filter( 'sanitize_user', 'strtolower' );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Blogs
|
2010-03-03 08:04:25 +01:00
|
|
|
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 );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Register Nonce
|
2010-03-03 08:04:25 +01:00
|
|
|
add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Template
|
2010-03-03 08:04:25 +01:00
|
|
|
add_action( 'template_redirect', 'maybe_redirect_404' );
|
|
|
|
add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Administration
|
2010-03-03 08:04:25 +01:00
|
|
|
add_filter( 'term_id_filter', 'global_terms', 10, 2 );
|
|
|
|
add_action( 'publish_post', 'update_posts_count' );
|
2012-04-13 19:30:37 +02:00
|
|
|
add_action( 'delete_post', '_update_blog_date_on_post_delete' );
|
2011-11-03 18:06:45 +01:00
|
|
|
add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
|
2013-09-25 18:21:09 +02:00
|
|
|
|
|
|
|
// Counts
|
2010-10-20 22:22:14 +02:00
|
|
|
add_action( 'admin_init', 'wp_schedule_update_network_counts');
|
|
|
|
add_action( 'update_network_counts', 'wp_update_network_counts');
|
2013-09-25 18:21:09 +02:00
|
|
|
foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
|
|
|
|
add_action( $action, 'wp_maybe_update_network_user_counts' );
|
|
|
|
foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
|
|
|
|
add_action( $action, 'wp_maybe_update_network_site_counts' );
|
|
|
|
unset( $action );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Files
|
2010-03-03 08:04:25 +01:00
|
|
|
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' );
|
2010-05-04 00:58:04 +02:00
|
|
|
add_filter( 'upload_size_limit', 'upload_size_limit_filter' );
|
2012-07-10 15:33:44 +02:00
|
|
|
add_action( 'upload_ui_over_quota', 'multisite_over_quota_message' );
|
2010-01-06 05:02:57 +01:00
|
|
|
|
|
|
|
// Mail
|
2010-02-25 22:57:38 +01:00
|
|
|
add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
|
2010-02-25 22:56:28 +01:00
|
|
|
|
|
|
|
// Disable somethings by default for multisite
|
|
|
|
add_filter( 'enable_update_services_configuration', '__return_false' );
|
2010-03-03 08:04:25 +01:00
|
|
|
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' );
|
2010-09-09 04:43:18 +02:00
|
|
|
add_filter( 'force_filtered_html_on_import', '__return_true' );
|
|
|
|
|
2010-05-08 21:31:42 +02:00
|
|
|
// WP_HOME and WP_SITEURL should not have any effect in MS
|
|
|
|
remove_filter( 'option_siteurl', '_config_wp_siteurl' );
|
|
|
|
remove_filter( 'option_home', '_config_wp_home' );
|
2012-09-12 00:22:20 +02:00
|
|
|
|
|
|
|
// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
|
2013-07-31 08:44:57 +02:00
|
|
|
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
|
|
|
|
|
|
|
|
// Whitelist multisite domains for HTTP requests
|
|
|
|
add_filter( 'http_request_host_is_external', 'ms_allowed_http_request_hosts', 20, 2 );
|