Changeset 10110 for trunk/src/bp-blogs/bp-blogs-template.php
- Timestamp:
- 09/14/2015 03:39:38 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r10100 r10110 385 385 * @type array $include_blog_ids Array of blog IDs to limit results to. 386 386 * @type string $sort 'ASC' or 'DESC'. Default: 'DESC'. 387 * @type string $search_terms Limit results by a search term. Default: the 388 * value of $_REQUEST['s'], if present.387 * @type string $search_terms Limit results by a search term. Default: the value of `$_REQUEST['s']` or 388 * `$_REQUEST['sites_search']`, if present. 389 389 * @type int $user_id The ID of the user whose blogs should be retrieved. 390 390 * When viewing a user profile page, 'user_id' defaults to the … … 396 396 global $blogs_template; 397 397 398 // Check for and use search terms 399 $search_terms = ! empty( $_REQUEST['s'] ) 400 ? $_REQUEST['s'] 401 : false; 398 // Check for and use search terms. 399 $search_terms_default = false; 400 $search_query_arg = bp_core_get_component_search_query_arg( 'blogs' ); 401 if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) { 402 $search_terms_default = stripslashes( $_REQUEST[ $search_query_arg ] ); 403 } elseif ( ! empty( $_REQUEST['s'] ) ) { 404 $search_terms_default = stripslashes( $_REQUEST['s'] ); 405 } 402 406 403 407 // Parse arguments … … 410 414 'user_id' => bp_displayed_user_id(), // Pass a user_id to limit to only blogs this user is a member of 411 415 'include_blog_ids' => false, 412 'search_terms' => $search_terms , // Pass search terms to filter on the blog title or description.416 'search_terms' => $search_terms_default, 413 417 'update_meta_cache' => true 414 418 ), 'has_blogs' ); … … 1450 1454 */ 1451 1455 function bp_directory_blogs_search_form() { 1452 $default_search_value = bp_get_search_default_text(); 1453 $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 1456 1457 $query_arg = bp_core_get_component_search_query_arg( 'blogs' ); 1458 1459 if ( ! empty( $_REQUEST[ $query_arg ] ) ) { 1460 $search_value = stripslashes( $_REQUEST[ $query_arg ] ); 1461 } else { 1462 $search_value = bp_get_search_default_text( 'blogs' ); 1463 } 1454 1464 1455 1465 $search_form_html = '<form action="" method="get" id="search-blogs-form"> 1456 <label><input type="text" name=" s" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label>1466 <label><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label> 1457 1467 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . __( 'Search', 'buddypress' ) . '" /> 1458 1468 </form>';
Note: See TracChangeset
for help on using the changeset viewer.