diff --git src/bp-core/bp-core-caps.php src/bp-core/bp-core-caps.php
index 7d1d00482..24273eb2a 100644
|
|
|
function bp_user_can( $user_id, $capability, $args = array() ) { |
| 375 | 375 | * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant. |
| 376 | 376 | */ |
| 377 | 377 | function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { |
| | 378 | $admin_caps = bp_get_caps_for_role( 'administrator' ); |
| 378 | 379 | |
| 379 | 380 | // Bail if not checking the 'bp_moderate' cap. |
| 380 | | if ( 'bp_moderate' !== $cap ) { |
| | 381 | if ( ! in_array( $cap, $admin_caps, true ) ) { |
| 381 | 382 | return $caps; |
| 382 | 383 | } |
| 383 | 384 | |
diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php
index ec84a6990..65d97834c 100644
|
|
|
add_filter( 'bp_email_set_content_html', 'wp_filter_post_kses', 6 ); |
| 58 | 58 | add_filter( 'bp_email_set_content_html', 'stripslashes', 8 ); |
| 59 | 59 | add_filter( 'bp_email_set_content_plaintext', 'wp_strip_all_tags', 6 ); |
| 60 | 60 | add_filter( 'bp_email_set_subject', 'sanitize_text_field', 6 ); |
| | 61 | add_filter( 'bp_get_caps_for_role', 'bp_email_set_caps_for_role', 10, 2 ); |
| 61 | 62 | |
| 62 | 63 | /** |
| 63 | 64 | * Template Compatibility. |
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index c1481135e..62fbd3d40 100644
|
|
|
function bp_email_get_unsubscribe_type_schema() { |
| 3861 | 3861 | return (array) apply_filters( 'bp_email_get_unsubscribe_type_schema', $emails ); |
| 3862 | 3862 | } |
| 3863 | 3863 | |
| | 3864 | /** |
| | 3865 | * Sets the role's BP Email capabilities. |
| | 3866 | * |
| | 3867 | * @since 7.0.0 |
| | 3868 | * |
| | 3869 | * @param array $caps Array of capabilities to return. |
| | 3870 | * @param string $role The role currently being requested. |
| | 3871 | * @return array The role BP Email caps. |
| | 3872 | */ |
| | 3873 | function bp_email_set_caps_for_role( $caps = array(), $role = '' ) { |
| | 3874 | $bp_email_post_type = get_post_type_object( bp_get_email_post_type() ); |
| | 3875 | |
| | 3876 | if ( $bp_email_post_type ) { |
| | 3877 | $bp_email_post_type_caps = get_object_vars( $bp_email_post_type->cap ); |
| | 3878 | |
| | 3879 | if ( 'administrator' === $role ) { |
| | 3880 | $caps = array_merge( |
| | 3881 | $caps, |
| | 3882 | array_values( $bp_email_post_type_caps ) |
| | 3883 | ); |
| | 3884 | } |
| | 3885 | } |
| | 3886 | |
| | 3887 | return $caps; |
| | 3888 | } |
| | 3889 | |
| 3864 | 3890 | /** |
| 3865 | 3891 | * Get BuddyPress content allowed tags. |
| 3866 | 3892 | * |
diff --git src/bp-core/classes/class-bp-core.php src/bp-core/classes/class-bp-core.php
index 7a322133a..0ca0e16e1 100644
|
|
|
class BP_Core extends BP_Component { |
| 306 | 306 | bp_get_email_post_type(), |
| 307 | 307 | apply_filters( 'bp_register_email_post_type', array( |
| 308 | 308 | 'description' => _x( 'BuddyPress emails', 'email post type description', 'buddypress' ), |
| 309 | | 'capabilities' => array( |
| 310 | | 'edit_posts' => 'bp_moderate', |
| 311 | | 'edit_others_posts' => 'bp_moderate', |
| 312 | | 'publish_posts' => 'bp_moderate', |
| 313 | | 'read_private_posts' => 'bp_moderate', |
| 314 | | 'delete_posts' => 'bp_moderate', |
| 315 | | 'delete_others_posts' => 'bp_moderate', |
| 316 | | ), |
| 317 | | 'map_meta_cap' => true, |
| | 309 | 'capability_type' => 'bp_email', |
| 318 | 310 | 'labels' => bp_get_email_post_type_labels(), |
| 319 | 311 | 'menu_icon' => 'dashicons-email', |
| 320 | 312 | 'public' => false, |