Ticket #6844: 6844.diff
File 6844.diff, 4.5 KB (added by , 9 years ago) |
---|
-
src/bp-core/bp-core-functions.php
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php index 69a914e..0ffacf8 100644
function bp_core_add_illegal_names() { 856 856 * @param string $component Component name. 857 857 * @return string|bool Query argument on success. False on failure. 858 858 */ 859 function bp_core_get_component_search_query_arg( $component ) { 859 function bp_core_get_component_search_query_arg( $component = null ) { 860 if ( ! $component ) { 861 $component = bp_current_component(); 862 } 863 860 864 $query_arg = false; 861 865 if ( isset( buddypress()->{$component}->search_query_arg ) ) { 862 866 $query_arg = sanitize_title( buddypress()->{$component}->search_query_arg ); -
src/bp-core/bp-core-template.php
diff --git src/bp-core/bp-core-template.php src/bp-core/bp-core-template.php index 9a58780..9e6c2cc 100644
function bp_search_form_type_select() { 551 551 } 552 552 553 553 /** 554 * Output the 'name' attribute for search form input element. 555 * 556 * @since 2.5.0 557 * 558 * @param string $component See {@link bp_get_search_input_name()}. 559 */ 560 function bp_search_input_name( $component = '' ) { 561 echo esc_attr( bp_get_search_input_name( $component ) ); 562 } 563 /** 564 * Get the 'name' attribute for the search form input element. 565 * 566 * @since 2.5.0 567 * 568 * @param string $component Component name. Defaults to current component. 569 * @return string Text for the 'name' attribute. 570 */ 571 function bp_get_search_input_name( $component = '' ) { 572 if ( ! $component ) { 573 $component = bp_current_component(); 574 } 575 576 $bp = buddypress(); 577 578 $name = ''; 579 if ( isset( $bp->{$component}->id ) ) { 580 $name = $bp->{$component}->id . '_search'; 581 } 582 583 return $name; 584 } 585 586 /** 587 * Output the placeholder text for the search box for a given component. 588 * 589 * @since 2.5.0 590 * 591 * @param string $component See {@link bp_get_search_placeholder()}. 592 */ 593 function bp_search_placeholder( $component = '' ) { 594 echo esc_attr( bp_get_search_placeholder( $component ) ); 595 } 596 /** 597 * Get the placeholder text for the search box for a given component. 598 * 599 * @since 2.5.0 600 * 601 * @param string $component Component name. Defaults to current component. 602 * @return string Placeholder text for the search field. 603 */ 604 function bp_get_search_placeholder( $component = '' ) { 605 $query_arg = bp_core_get_component_search_query_arg( $component ); 606 607 if ( $query_arg && ! empty( $_REQUEST[ $query_arg ] ) ) { 608 $placeholder = wp_unslash( $_REQUEST[ $query_arg ] ); 609 } else { 610 $placeholder = bp_get_search_default_text( $component ); 611 } 612 613 return $placeholder; 614 } 615 616 /** 554 617 * Output the default text for the search box for a given component. 555 618 * 556 619 * @since 1.5.0 -
new file src/bp-templates/bp-legacy/buddypress/common/search-form.php
diff --git src/bp-templates/bp-legacy/buddypress/common/search-form.php src/bp-templates/bp-legacy/buddypress/common/search-form.php new file mode 100644 index 0000000..ef5879e
- + 1 <div id="members-dir-search" class="dir-search" role="search"> 2 <form action="" method="get" id="search-<?php echo esc_attr( bp_current_component() ); ?>-form"> 3 <label for="<?php bp_search_input_name(); ?>"><input type="text" name="<?php echo esc_attr( bp_core_get_component_search_query_arg() ); ?>" id="<?php bp_search_input_name(); ?>" placeholder="<?php bp_search_placeholder(); ?>" /></label> 4 <input type="submit" id="<?php bp_search_input_name(); ?>_submit" name="<?php bp_search_input_name(); ?>_submit" value="<?php esc_html_e( 'Search', 'buddypress' ); ?>" /> 5 </form> 6 </div><!-- #members-dir-search --> -
src/bp-templates/bp-legacy/buddypress/members/index.php
diff --git src/bp-templates/bp-legacy/buddypress/members/index.php src/bp-templates/bp-legacy/buddypress/members/index.php index 200b860..c161db5 100644
do_action( 'bp_before_directory_members_page' ); ?> 33 33 */ 34 34 do_action( 'bp_before_directory_members_content' ); ?> 35 35 36 <div id="members-dir-search" class="dir-search" role="search"> 37 <?php bp_directory_members_search_form(); ?> 38 </div><!-- #members-dir-search --> 36 <?php if ( has_filter( 'bp_directory_members_search_form' ) ) : ?> 37 <div id="members-dir-search" class="dir-search" role="search"> 38 <?php bp_directory_members_search_form(); ?> 39 </div><!-- #members-dir-search --> 40 <?php else : ?> 41 <?php bp_get_template_part( 'common/search-form' ); ?> 42 <?php endif; ?> 39 43 40 44 <?php 41 45