Changeset 14328
- Timestamp:
- 10/09/2026 09:57:58 PM (5 weeks ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/bp-core/bp-core-functions.php (modified) (1 diff)
-
tests/phpunit/testcases/admin/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r14326 r14328 4537 4537 'groups-membership-request-rejected-by-admin' => $groups_membership_request_rejected_by_admin, 4538 4538 ); 4539 4540 /** 4541 * Filters the list of `bp_email_get_type_schema()` allowing anyone to add/remove email types. 4542 * 4543 * @since 15.0.0 4544 * 4545 * @param array $types The array of email type schema. 4546 */ 4547 $types = (array) apply_filters( 'bp_email_get_type_schema', $types ); 4539 4548 4540 4549 if ( $field !== 'all' ) { -
trunk/tests/phpunit/testcases/admin/functions.php
r14316 r14328 258 258 } 259 259 260 /** 261 * @ticket BP9329 262 */ 263 public function test_bp_email_get_type_schema_should_allow_custom_types() { 264 add_filter( 'bp_email_get_schema', array( $this, 'filter_bp_email_get_schema' ) ); 265 add_filter( 'bp_email_get_type_schema', array( $this, 'filter_bp_email_get_type_schema' ) ); 266 267 try { 268 $types = bp_email_get_type_schema( 'all' ); 269 $this->assertArrayHasKey( 'test-email-type', $types ); 270 $this->assertSame( 'Test email type description.', $types['test-email-type']['description'] ); 271 272 $descriptions = bp_email_get_type_schema( 'description' ); 273 $this->assertSame( 'Test email type description.', $descriptions['test-email-type'] ); 274 275 require_once( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin-schema.php' ); 276 bp_core_install_emails(); 277 278 $term = get_term_by( 'slug', 'test-email-type', bp_get_email_tax_type() ); 279 $this->assertInstanceOf( 'WP_Term', $term ); 280 $this->assertSame( 'Test email type description.', $term->description ); 281 } finally { 282 remove_filter( 'bp_email_get_schema', array( $this, 'filter_bp_email_get_schema' ) ); 283 remove_filter( 'bp_email_get_type_schema', array( $this, 'filter_bp_email_get_type_schema' ) ); 284 } 285 } 286 287 public function filter_bp_email_get_schema( $emails ) { 288 $emails['test-email-type'] = array( 289 'post_title' => 'Test email type', 290 'post_content' => 'Test email type content.', 291 'post_excerpt' => 'Test email type content.', 292 ); 293 294 return $emails; 295 } 296 297 public function filter_bp_email_get_type_schema( $types ) { 298 $types['test-email-type'] = array( 299 'description' => 'Test email type description.', 300 'named_salutation' => false, 301 'unsubscribe' => false, 302 ); 303 304 return $types; 305 } 306 260 307 public function is_active_filter( $is_active, $component ) { 261 308 if ( ! $is_active && 'attachments' === $component ) {
Note:
See TracChangeset
for help on using the changeset viewer.