wp/wp-includes/ms-default-filters.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    25 add_action( 'init', 'maybe_add_existing_user_to_blog' );
    25 add_action( 'init', 'maybe_add_existing_user_to_blog' );
    26 add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    26 add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    27 add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
    27 add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
    28 add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
    28 add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
    29 add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
    29 add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
    30 add_action( 'network_site_new_created_user',   'wp_send_new_user_notifications' );
    30 add_action( 'network_site_new_created_user', 'wp_send_new_user_notifications' );
    31 add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' );
    31 add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' );
    32 add_action( 'network_user_new_created_user',   'wp_send_new_user_notifications' );
    32 add_action( 'network_user_new_created_user', 'wp_send_new_user_notifications' );
    33 add_filter( 'sanitize_user', 'strtolower' );
    33 add_filter( 'sanitize_user', 'strtolower' );
    34 
    34 
    35 // Roles
    35 // Roles
    36 add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
    36 add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
    37 
    37 
    38 // Blogs
    38 // Blogs
    39 add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
    39 add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
    40 add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
       
    41 add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
       
    42 add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
    40 add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
    43 add_action( 'after_signup_site', 'wpmu_signup_blog_notification', 10, 7 );
    41 add_action( 'after_signup_site', 'wpmu_signup_blog_notification', 10, 7 );
       
    42 add_filter( 'wp_normalize_site_data', 'wp_normalize_site_data', 10, 1 );
       
    43 add_action( 'wp_validate_site_data', 'wp_validate_site_data', 10, 3 );
       
    44 add_action( 'wp_insert_site', 'wp_maybe_update_network_site_counts_on_update', 10, 1 );
       
    45 add_action( 'wp_update_site', 'wp_maybe_update_network_site_counts_on_update', 10, 2 );
       
    46 add_action( 'wp_delete_site', 'wp_maybe_update_network_site_counts_on_update', 10, 1 );
       
    47 add_action( 'wp_insert_site', 'wp_maybe_transition_site_statuses_on_update', 10, 1 );
       
    48 add_action( 'wp_update_site', 'wp_maybe_transition_site_statuses_on_update', 10, 2 );
       
    49 add_action( 'wp_update_site', 'wp_maybe_clean_new_site_cache_on_update', 10, 2 );
       
    50 add_action( 'wp_initialize_site', 'wp_initialize_site', 10, 2 );
       
    51 add_action( 'wp_initialize_site', 'wpmu_log_new_registrations', 100, 2 );
       
    52 add_action( 'wp_initialize_site', 'newblog_notify_siteadmin', 100, 1 );
       
    53 add_action( 'wp_uninitialize_site', 'wp_uninitialize_site', 10, 1 );
       
    54 add_action( 'update_blog_public', 'wp_update_blog_public_option_on_site_update', 1, 2 );
       
    55 
       
    56 // Site meta
       
    57 add_action( 'added_blog_meta', 'wp_cache_set_sites_last_changed' );
       
    58 add_action( 'updated_blog_meta', 'wp_cache_set_sites_last_changed' );
       
    59 add_action( 'deleted_blog_meta', 'wp_cache_set_sites_last_changed' );
       
    60 add_filter( 'get_blog_metadata', 'wp_check_site_meta_support_prefilter' );
       
    61 add_filter( 'add_blog_metadata', 'wp_check_site_meta_support_prefilter' );
       
    62 add_filter( 'update_blog_metadata', 'wp_check_site_meta_support_prefilter' );
       
    63 add_filter( 'delete_blog_metadata', 'wp_check_site_meta_support_prefilter' );
       
    64 add_filter( 'get_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );
       
    65 add_filter( 'update_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );
       
    66 add_filter( 'delete_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );
       
    67 add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
    44 
    68 
    45 // Register Nonce
    69 // Register Nonce
    46 add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
    70 add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
    47 
    71 
    48 // Template
    72 // Template
    55 add_action( 'delete_post', '_update_blog_date_on_post_delete' );
    79 add_action( 'delete_post', '_update_blog_date_on_post_delete' );
    56 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
    80 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
    57 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
    81 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
    58 
    82 
    59 // Counts
    83 // Counts
    60 add_action( 'admin_init', 'wp_schedule_update_network_counts');
    84 add_action( 'admin_init', 'wp_schedule_update_network_counts' );
    61 add_action( 'update_network_counts', 'wp_update_network_counts', 10, 0 );
    85 add_action( 'update_network_counts', 'wp_update_network_counts', 10, 0 );
    62 foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
    86 foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action ) {
    63 	add_action( $action, 'wp_maybe_update_network_user_counts', 10, 0 );
    87 	add_action( $action, 'wp_maybe_update_network_user_counts', 10, 0 );
    64 foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
    88 }
       
    89 foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action ) {
    65 	add_action( $action, 'wp_maybe_update_network_site_counts', 10, 0 );
    90 	add_action( $action, 'wp_maybe_update_network_site_counts', 10, 0 );
       
    91 }
    66 unset( $action );
    92 unset( $action );
    67 
    93 
    68 // Files
    94 // Files
    69 add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
    95 add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
    70 add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
    96 add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
    75 // Mail
   101 // Mail
    76 add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
   102 add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
    77 
   103 
    78 // Disable somethings by default for multisite
   104 // Disable somethings by default for multisite
    79 add_filter( 'enable_update_services_configuration', '__return_false' );
   105 add_filter( 'enable_update_services_configuration', '__return_false' );
    80 if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
   106 if ( ! defined( 'POST_BY_EMAIL' ) || ! POST_BY_EMAIL ) { // back compat constant.
    81 	add_filter( 'enable_post_by_email_configuration', '__return_false' );
   107 	add_filter( 'enable_post_by_email_configuration', '__return_false' );
    82 if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
   108 }
       
   109 if ( ! defined( 'EDIT_ANY_USER' ) || ! EDIT_ANY_USER ) { // back compat constant.
    83 	add_filter( 'enable_edit_any_user_configuration', '__return_false' );
   110 	add_filter( 'enable_edit_any_user_configuration', '__return_false' );
       
   111 }
    84 add_filter( 'force_filtered_html_on_import', '__return_true' );
   112 add_filter( 'force_filtered_html_on_import', '__return_true' );
    85 
   113 
    86 // WP_HOME and WP_SITEURL should not have any effect in MS
   114 // WP_HOME and WP_SITEURL should not have any effect in MS
    87 remove_filter( 'option_siteurl', '_config_wp_siteurl' );
   115 remove_filter( 'option_siteurl', '_config_wp_siteurl' );
    88 remove_filter( 'option_home',    '_config_wp_home'    );
   116 remove_filter( 'option_home', '_config_wp_home' );
    89 
   117 
    90 // Some options changes should trigger site details refresh.
   118 // Some options changes should trigger site details refresh.
    91 add_action( 'update_option_blogname',   'clean_site_details_cache', 10, 0 );
   119 add_action( 'update_option_blogname', 'clean_site_details_cache', 10, 0 );
    92 add_action( 'update_option_siteurl',    'clean_site_details_cache', 10, 0 );
   120 add_action( 'update_option_siteurl', 'clean_site_details_cache', 10, 0 );
    93 add_action( 'update_option_post_count', 'clean_site_details_cache', 10, 0 );
   121 add_action( 'update_option_post_count', 'clean_site_details_cache', 10, 0 );
    94 add_action( 'update_option_home',       'clean_site_details_cache', 10, 0 );
   122 add_action( 'update_option_home', 'clean_site_details_cache', 10, 0 );
    95 
   123 
    96 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
   124 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
    97 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
   125 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
    98 
   126 
    99 // Whitelist multisite domains for HTTP requests
   127 // Whitelist multisite domains for HTTP requests