Skip to:
Content

BuddyPress.org

Changeset 10765


Ignore:
Timestamp:
05/14/2016 05:59:21 PM (4 years ago)
Author:
r-a-y
Message:

Emails: Register our email type taxonomy at all times.

Fixes an issue where attempting to use bp_get_email() / bp_send_email()
on a non-root blog would fail.

In bp_get_email(), get_posts() is used to fetch our email post type.
Since we are doing a taxonomy query in get_posts(), WP_Tax_Query::clean_query
attempts to see if our taxonomy exists. Since our taxonomy did not exist on
non-root blogs, the taxonomy SQL clauses would not be added and
bp_get_email() would fail.

See #WP20541 for more details.

See #7055 (trunk)

File:
1 edited

Legend:

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

    r10581 r10765  
    2727
    2828    // Email type.
    29     if ( bp_is_root_blog() ) {
    30         register_taxonomy(
    31             bp_get_email_tax_type(),
    32             bp_get_email_post_type(),
    33             apply_filters( 'bp_register_email_tax_type', array(
    34                 'description'   => _x( 'BuddyPress email types', 'email type taxonomy description', 'buddypress' ),
    35                 'labels'        => bp_get_email_tax_type_labels(),
    36                 'meta_box_cb'   => 'bp_email_tax_type_metabox',
    37                 'public'        => false,
    38                 'query_var'     => false,
    39                 'rewrite'       => false,
    40                 'show_in_menu'  => false,
    41                 'show_tagcloud' => false,
    42                 'show_ui'       => bp_current_user_can( 'bp_moderate' ),
    43             ) )
    44         );
    45     }
     29    register_taxonomy(
     30        bp_get_email_tax_type(),
     31        bp_get_email_post_type(),
     32        apply_filters( 'bp_register_email_tax_type', array(
     33            'description'   => _x( 'BuddyPress email types', 'email type taxonomy description', 'buddypress' ),
     34            'labels'        => bp_get_email_tax_type_labels(),
     35            'meta_box_cb'   => 'bp_email_tax_type_metabox',
     36            'public'        => false,
     37            'query_var'     => false,
     38            'rewrite'       => false,
     39            'show_in_menu'  => false,
     40            'show_tagcloud' => false,
     41            'show_ui'       => bp_is_root_blog() && bp_current_user_can( 'bp_moderate' ),
     42        ) )
     43    );
    4644}
    4745add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
Note: See TracChangeset for help on using the changeset viewer.