wp/wp-includes/ms-default-filters.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    11  * @subpackage Multisite
    11  * @subpackage Multisite
    12  * @see default-filters.php
    12  * @see default-filters.php
    13  * @since 3.0.0
    13  * @since 3.0.0
    14  */
    14  */
    15 
    15 
       
    16 add_action( 'init', 'ms_subdomain_constants' );
       
    17 
    16 // Functions
    18 // Functions
    17 add_action( 'update_option_blog_public', 'update_blog_public', 10, 2 );
    19 add_action( 'update_option_blog_public', 'update_blog_public', 10, 2 );
    18 add_filter( 'option_users_can_register', 'users_can_register_signup_filter' );
    20 add_filter( 'option_users_can_register', 'users_can_register_signup_filter' );
    19 add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
    21 add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
    20 
    22 
    21 // Users
    23 // Users
    22 add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
    24 add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
    23 add_action( 'init', 'maybe_add_existing_user_to_blog' );
    25 add_action( 'init', 'maybe_add_existing_user_to_blog' );
    24 add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    26 add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    25 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 );
       
    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' );
       
    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' );
    26 add_filter( 'sanitize_user', 'strtolower' );
    33 add_filter( 'sanitize_user', 'strtolower' );
       
    34 
       
    35 // Roles
       
    36 add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
    27 
    37 
    28 // Blogs
    38 // Blogs
    29 add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
    39 add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
    30 add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
    40 add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
    31 add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
    41 add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
       
    42 add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
       
    43 add_action( 'after_signup_site', 'wpmu_signup_blog_notification', 10, 7 );
    32 
    44 
    33 // Register Nonce
    45 // Register Nonce
    34 add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
    46 add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
    35 
    47 
    36 // Template
    48 // Template
    40 // Administration
    52 // Administration
    41 add_filter( 'term_id_filter', 'global_terms', 10, 2 );
    53 add_filter( 'term_id_filter', 'global_terms', 10, 2 );
    42 add_action( 'delete_post', '_update_posts_count_on_delete' );
    54 add_action( 'delete_post', '_update_posts_count_on_delete' );
    43 add_action( 'delete_post', '_update_blog_date_on_post_delete' );
    55 add_action( 'delete_post', '_update_blog_date_on_post_delete' );
    44 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
    56 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
    45 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2 );
    57 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 );
    46 
    58 
    47 // Counts
    59 // Counts
    48 add_action( 'admin_init', 'wp_schedule_update_network_counts');
    60 add_action( 'admin_init', 'wp_schedule_update_network_counts');
    49 add_action( 'update_network_counts', 'wp_update_network_counts');
    61 add_action( 'update_network_counts', 'wp_update_network_counts', 10, 0 );
    50 foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
    62 foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
    51 	add_action( $action, 'wp_maybe_update_network_user_counts' );
    63 	add_action( $action, 'wp_maybe_update_network_user_counts', 10, 0 );
    52 foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
    64 foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
    53 	add_action( $action, 'wp_maybe_update_network_site_counts' );
    65 	add_action( $action, 'wp_maybe_update_network_site_counts', 10, 0 );
    54 unset( $action );
    66 unset( $action );
    55 
    67 
    56 // Files
    68 // Files
    57 add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
    69 add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
    58 add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
    70 add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
    73 
    85 
    74 // WP_HOME and WP_SITEURL should not have any effect in MS
    86 // WP_HOME and WP_SITEURL should not have any effect in MS
    75 remove_filter( 'option_siteurl', '_config_wp_siteurl' );
    87 remove_filter( 'option_siteurl', '_config_wp_siteurl' );
    76 remove_filter( 'option_home',    '_config_wp_home'    );
    88 remove_filter( 'option_home',    '_config_wp_home'    );
    77 
    89 
    78 // Some options changes should trigger blog details refresh.
    90 // Some options changes should trigger site details refresh.
    79 add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
    91 add_action( 'update_option_blogname',   'clean_site_details_cache', 10, 0 );
    80 add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
    92 add_action( 'update_option_siteurl',    'clean_site_details_cache', 10, 0 );
    81 add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
    93 add_action( 'update_option_post_count', 'clean_site_details_cache', 10, 0 );
       
    94 add_action( 'update_option_home',       'clean_site_details_cache', 10, 0 );
    82 
    95 
    83 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
    96 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
    84 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
    97 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
    85 
    98 
    86 // Whitelist multisite domains for HTTP requests
    99 // Whitelist multisite domains for HTTP requests