Skip to:
Content

BuddyPress.org

Changeset 10485


Ignore:
Timestamp:
01/31/2016 12:11:16 PM (11 years ago)
Author:
djpaul
Message:

Emails: only register email post type for root blog.

Prevents the email post type appearing in other sites' wp-admin areas in a network-activated multisite configuration.
An alternate approach would be to set show_ui to hide the menu item, but the post type may still end up being revealed in other parts of admin screens, or through newer interfaces such as WP's REST API.

Props imath

See #6592

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-loader.php

    r10474 r10485  
    295295
    296296                // Emails
    297                 register_post_type(
    298                         bp_get_email_post_type(),
    299                         apply_filters( 'bp_register_email_post_type', array(
    300                                 'description'       => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ),
    301                                 'labels'            => bp_get_email_post_type_labels(),
    302                                 'menu_icon'         => 'dashicons-email',
    303                                 'public'            => false,
    304                                 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ),
    305                                 'query_var'         => false,
    306                                 'rewrite'           => false,
    307                                 'show_in_admin_bar' => false,
    308                                 'show_ui'           => bp_current_user_can( 'bp_moderate' ),
    309                                 'supports'          => bp_get_email_post_type_supports(),
    310                         ) )
    311                 );
     297                if ( bp_is_root_blog() ) {
     298                        register_post_type(
     299                                bp_get_email_post_type(),
     300                                apply_filters( 'bp_register_email_post_type', array(
     301                                        'description'       => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ),
     302                                        'labels'            => bp_get_email_post_type_labels(),
     303                                        'menu_icon'         => 'dashicons-email',
     304                                        'public'            => false,
     305                                        'publicly_queryable' => bp_current_user_can( 'bp_moderate' ),
     306                                        'query_var'         => false,
     307                                        'rewrite'           => false,
     308                                        'show_in_admin_bar' => false,
     309                                        'show_ui'           => bp_current_user_can( 'bp_moderate' ),
     310                                        'supports'          => bp_get_email_post_type_supports(),
     311                                ) )
     312                        );
     313                }
    312314
    313315                parent::register_post_types();
Note: See TracChangeset for help on using the changeset viewer.