Changeset 9180
- Timestamp:
- 11/25/2014 06:52:58 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r9177 r9180 383 383 if ( empty( $component_name ) || empty( $page_id ) ) { 384 384 unset( $page_ids[ $component_name ] ); 385 } 386 387 // 'register' and 'activate' do not have components, but should be whitelisted. 388 if ( bp_get_signup_allowed() && ( 'register' === $component_name || 'activate' === $component_name ) ) { 389 continue; 385 390 } 386 391 -
trunk/tests/phpunit/testcases/core/functions.php
r9177 r9180 369 369 370 370 /** 371 * @group bp_core_get_directory_page_ids 372 */ 373 public function test_bp_core_get_directory_page_ids_should_contain_register_and_activet_pages_when_registration_is_open() { 374 add_filter( 'bp_get_signup_allowed', '__return_true', 999 ); 375 376 $ac = buddypress()->active_components; 377 bp_core_add_page_mappings( array_keys( $ac ) ); 378 379 $page_ids = bp_core_get_directory_page_ids(); 380 $page_names = array_keys( $page_ids ); 381 382 $this->assertContains( 'register', $page_names ); 383 $this->assertContains( 'activate', $page_names ); 384 385 remove_filter( 'bp_get_signup_allowed', '__return_true', 999 ); 386 } 387 388 /** 389 * @group bp_core_get_directory_page_ids 390 */ 391 public function test_bp_core_get_directory_page_ids_should_not_contain_register_and_activet_pages_when_registration_is_closed() { 392 393 // Make sure the pages exist, to verify they're filtered out. 394 add_filter( 'bp_get_signup_allowed', '__return_true', 999 ); 395 $ac = buddypress()->active_components; 396 bp_core_add_page_mappings( array_keys( $ac ) ); 397 remove_filter( 'bp_get_signup_allowed', '__return_true', 999 ); 398 399 add_filter( 'bp_get_signup_allowed', '__return_false', 999 ); 400 $page_ids = bp_core_get_directory_page_ids(); 401 remove_filter( 'bp_get_signup_allowed', '__return_false', 999 ); 402 403 $page_names = array_keys( $page_ids ); 404 405 $this->assertNotContains( 'register', $page_names ); 406 $this->assertNotContains( 'activate', $page_names ); 407 } 408 409 /** 371 410 * @group bp_core_get_directory_pages 372 411 */
Note: See TracChangeset
for help on using the changeset viewer.