[buddypress-trac] [BuddyPress Trac] #4154: BuddyPress not allow use search like domain.com/search/my+search+text

buddypress-trac noreply at wordpress.org
Thu May 30 04:07:52 UTC 2019


#4154: BuddyPress not allow use search like domain.com/search/my+search+text
--------------------------+---------------------
 Reporter:  Ivinco        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.0.0
Component:  Route Parser  |     Version:  1.5.5
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |
--------------------------+---------------------
Changes (by imath):

 * keywords:  needs-patch needs-refresh => has-patch
 * component:  Core => Route Parser
 * milestone:  Awaiting Contributions => 5.0.0


Old description:

> Default wordpress Installation allows to search via url like
> domain.com/search/my+search+text
> BuddyPress don't allow these searches.
>
> I fixed this bug, but maybe is not the best way.
>

> [ 15:11:12 ] :> diff -u bp-core-catchuri-org.php bp-core-catchuri.php
> --- bp-core-catchuri-org.php    2012-04-19 15:10:37.000000000 +0300
> +++ bp-core-catchuri.php    2012-04-19 15:10:49.000000000 +0300
> @@ -375,6 +375,9 @@
>  function bp_core_catch_no_access() {
>     global $bp, $bp_no_status_set, $wp_query;
>
> +        if ($bp->current_component == 'search') {
> +            return true;
> +        }
>     // If bp_core_redirect() and $bp_no_status_set is true,
>     // we are redirecting to an accessible page, so skip this check.
>     if ( $bp_no_status_set )
>

> [15:13:56 ] :> diff -u bp-core-functions-org.php bp-core-functions.php
> --- bp-core-functions-org.php   2012-04-19 14:55:11.000000000 +0300
> +++ bp-core-functions.php   2012-04-19 14:55:57.000000000 +0300
> @@ -825,6 +825,10 @@
>   */
>  function bp_core_action_search_site( $slug = '' ) {
>     global $bp;
> +
> +        if ($bp->current_component == 'search') {
> +            return;
> +        }
>
>     if ( !bp_is_current_component( bp_get_search_slug() ) )
>         return;

New description:

 Default wordpress Installation allows to search via url like
 domain.com/search/my+search+text
 BuddyPress don't allow these searches.

 I fixed this bug, but maybe is not the best way.

 {{{
 [ 15:11:12 ] :> diff -u bp-core-catchuri-org.php bp-core-catchuri.php
 --- bp-core-catchuri-org.php    2012-04-19 15:10:37.000000000 +0300
 +++ bp-core-catchuri.php    2012-04-19 15:10:49.000000000 +0300
 @@ -375,6 +375,9 @@
  function bp_core_catch_no_access() {
     global $bp, $bp_no_status_set, $wp_query;

 +        if ($bp->current_component == 'search') {
 +            return true;
 +        }
     // If bp_core_redirect() and $bp_no_status_set is true,
     // we are redirecting to an accessible page, so skip this check.
     if ( $bp_no_status_set )


 [15:13:56 ] :> diff -u bp-core-functions-org.php bp-core-functions.php
 --- bp-core-functions-org.php   2012-04-19 14:55:11.000000000 +0300
 +++ bp-core-functions.php   2012-04-19 14:55:57.000000000 +0300
 @@ -825,6 +825,10 @@
   */
  function bp_core_action_search_site( $slug = '' ) {
     global $bp;
 +
 +        if ($bp->current_component == 'search') {
 +            return;
 +        }

     if ( !bp_is_current_component( bp_get_search_slug() ) )
         return;
 }}}

--

Comment:

 Hi!

 I think the least we need to do is to stop preventing WordPress to use
 `site.url/search/hello` pretty urls. It's not good. I think checking if
 `$_POST['search-terms']` is set won't break plugins as anyway
 `bp_core_action_search_site()` is redirecting to home if it's empty.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4154#comment:10>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list