<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][13520] trunk/src: Use BP Rewrites API functions instead of `home_url()` to build links</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/13520">13520</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/13520","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-07-17 09:01:08 +0000 (Mon, 17 Jul 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Use BP Rewrites API functions instead of `home_url()` to build links

See <a href="http://buddypress.trac.wordpress.org/ticket/4954">#4954</a>
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8937">#8937</a>
Closes https://github.com/buddypress/buddypress/pull/131</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpactivitybpactivitytemplatephp">trunk/src/bp-activity/bp-activity-template.php</a></li>
<li><a href="#trunksrcbpcorebpcorefunctionsphp">trunk/src/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressactivityentryphp">trunk/src/bp-templates/bp-legacy/buddypress/activity/entry.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressfunctionsphp">trunk/src/bp-templates/bp-legacy/buddypress-functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpactivitybpactivitytemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/bp-activity-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/bp-activity-template.php    2023-07-16 15:43:26 UTC (rev 13519)
+++ trunk/src/bp-activity/bp-activity-template.php      2023-07-17 09:01:08 UTC (rev 13520)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -420,7 +420,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_load_more_link() {
</span><span class="cx" style="display: block; padding: 0 10px">                global $activities_template;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $url            = bp_get_requested_url();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $url            = remove_query_arg( 'ac', bp_get_requested_url() );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $load_more_args = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        $activities_template->pag_arg => $activities_template->pag_page + 1,
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2609,14 +2609,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_comment_link() {
</span><span class="cx" style="display: block; padding: 0 10px">                global $activities_template;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $query_vars = array();
+
+               if ( isset( $_GET['acpage'] ) ) {
+                       $query_vars['acpage'] = (int) wp_unslash( $_GET['acpage'] );
+               }
+
+               if ( isset( $_GET['offset_lower'] ) ) {
+                       $query_vars['offset_lower'] = (int) wp_unslash( $_GET['offset_lower'] );
+               }
+
+               // This needs to be the last query var.
+               $query_vars['ac'] = $activities_template->activity->id;
+
+               $url = add_query_arg( $query_vars, bp_get_activity_directory_permalink() );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the comment link for the current activity comment.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $value Constructed URL parameters with activity IDs.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string $url Constructed URL parameters with activity IDs.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'bp_get_activity_comment_link', $url . '/#ac-form-' . $activities_template->activity->id );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2650,6 +2665,45 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Outputs the URL to cancel a comment.
+ *
+ * @since 12.0.0
+ */
+function bp_activity_comment_cancel_url() {
+       echo esc_url( bp_get_activity_comment_cancel_url() );
+}
+
+/**
+ * Returns the URL to cancel a comment.
+ *
+ * @since 12.0.0
+ *
+ * @return string The URL to cancel a comment.
+ */
+function bp_get_activity_comment_cancel_url() {
+       $query_vars = array();
+
+       if ( isset( $_GET['acpage'] ) ) {
+               $query_vars['acpage'] = (int) wp_unslash( $_GET['acpage'] );
+       }
+
+       if ( isset( $_GET['offset_lower'] ) ) {
+               $query_vars['offset_lower'] = (int) wp_unslash( $_GET['offset_lower'] );
+       }
+
+       $url = add_query_arg( $query_vars, bp_get_activity_directory_permalink() );
+
+       /**
+        * Filters the cancel comment link for the current activity comment.
+        *
+        * @since 12.0.0
+        *
+        * @param string $url Constructed URL parameters with activity IDs.
+        */
+       return apply_filters( 'bp_get_activity_comment_cancel_url', $url );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Output the activity comment form action.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 1.2.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2656,7 +2710,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_activity_comment_form_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        echo bp_get_activity_comment_form_action();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_url( bp_get_activity_comment_form_action() );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2664,10 +2718,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         *
</del><span class="cx" style="display: block; padding: 0 10px">          * @return string The activity comment form action.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_comment_form_action() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $url  = bp_rewrites_get_url(
+                       array(
+                               'component_id'       => 'activity',
+                               'single_item_action' => 'reply',
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the activity comment form action URL.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2674,9 +2733,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $value URL to use in the comment form's action attribute.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string $url URL to use in the comment form's action attribute.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'bp_get_activity_comment_form_action', $url );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2802,14 +2861,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_favorite_link() {
</span><span class="cx" style="display: block; padding: 0 10px">                global $activities_template;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $url = bp_rewrites_get_url(
+                       array(
+                               'component_id'                 => 'activity',
+                               'single_item_action'           => 'favorite',
+                               'single_item_action_variables' => array( $activities_template->activity->id ),
+                       )
+               );
+
+               $url = wp_nonce_url( $url, 'mark_favorite' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the activity favorite link.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $value Constructed link for favoriting the activity comment.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string $url Constructed link for favoriting the activity comment.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'bp_get_activity_favorite_link', $url );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2834,14 +2903,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_unfavorite_link() {
</span><span class="cx" style="display: block; padding: 0 10px">                global $activities_template;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $url = bp_rewrites_get_url(
+                       array(
+                               'component_id'                 => 'activity',
+                               'single_item_action'           => 'unfavorite',
+                               'single_item_action_variables' => array( $activities_template->activity->id ),
+                       )
+               );
+
+               $url = wp_nonce_url( $url, 'unmark_favorite' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the activity unfavorite link.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $value Constructed link for unfavoriting the activity comment.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string $url Constructed link for unfavoriting the activity comment.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'bp_get_activity_unfavorite_link', $url );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3588,6 +3667,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return string The activity post form action.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        function bp_get_activity_post_form_action() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $url  = bp_rewrites_get_url(
+                       array(
+                               'component_id'       => 'activity',
+                               'single_item_action' => 'post',
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the action url used for the activity post form.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3594,9 +3679,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $value URL to be used for the activity post form.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string $url URL to be used for the activity post form.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return apply_filters( 'bp_get_activity_post_form_action', home_url( bp_get_activity_root_slug() . '/post/' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return apply_filters( 'bp_get_activity_post_form_action', $url );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-functions.php   2023-07-16 15:43:26 UTC (rev 13519)
+++ trunk/src/bp-core/bp-core-functions.php     2023-07-17 09:01:08 UTC (rev 13520)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2533,51 +2533,69 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // Set default search URL.
+       $url = bp_get_root_url();
+
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( empty( $_POST['search-terms'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                bp_core_redirect( bp_get_root_url() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         bp_core_redirect( $url );
</ins><span class="cx" style="display: block; padding: 0 10px">                 return;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $search_terms = stripslashes( $_POST['search-terms'] );
-       $search_which = !empty( $_POST['search-which'] ) ? $_POST['search-which'] : '';
-       $query_string = '/?s=';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $search_terms         = sanitize_text_field( wp_unslash( $_POST['search-terms'] ) );
+       $encoded_search_terms = urlencode( $search_terms );
+       $search_which         = '';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if ( ! empty( $_POST['search-which'] ) ) {
+               $search_which = sanitize_key( wp_unslash( $_POST['search-which'] ) );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( empty( $slug ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $search_which ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'posts':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $slug = '';
-                               $var  = '/?s=';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $url = home_url();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // If posts aren't displayed on the front page, find the post page's slug.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                if ( 'page' == get_option( 'show_on_front' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( 'page' === get_option( 'show_on_front' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                         $page = get_post( get_option( 'page_for_posts' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( !is_wp_error( $page ) && !empty( $page->post_name ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! is_wp_error( $page ) && ! empty( $page->post_name ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $slug = $page->post_name;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                $var  = '?s=';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $url  = get_post_permalink( $page );
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                               $url = add_query_arg( 's', $encoded_search_terms, $url );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'activity':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $slug = bp_is_active( 'activity' )  ? bp_get_activity_root_slug()  : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( bp_is_active( 'activity' ) ) {
+                                       $slug = bp_get_activity_root_slug();
+                                       $url  = add_query_arg( 'activity_search', $encoded_search_terms, bp_get_activity_directory_permalink() );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'blogs':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $slug = bp_is_active( 'blogs' )  ? bp_get_blogs_root_slug()  : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( bp_is_active( 'blogs' ) ) {
+                                       $slug = bp_get_blogs_root_slug();
+                                       $url  = add_query_arg( 'sites_search', $encoded_search_terms, bp_get_blogs_directory_url() );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'groups':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $slug = bp_is_active( 'groups' ) ? bp_get_groups_root_slug() : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( bp_is_active( 'groups' ) ) {
+                                       $slug = bp_get_groups_root_slug();
+                                       $url  = add_query_arg( 'groups_search', $encoded_search_terms, bp_get_groups_directory_url() );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'members':
</span><span class="cx" style="display: block; padding: 0 10px">                        default:
</span><span class="cx" style="display: block; padding: 0 10px">                                $slug = bp_get_members_root_slug();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $url  = add_query_arg( 'members_search', $encoded_search_terms, bp_get_members_directory_permalink() );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( empty( $slug ) && 'posts' != $search_which ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( empty( $slug ) && 'posts' !== $search_which ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         bp_core_redirect( bp_get_root_url() );
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2588,10 +2606,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param string $value        URL for use with site searching.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param string $url        URL for use with site searching.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param array  $search_terms Array of search terms.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        bp_core_redirect( apply_filters( 'bp_core_search_site', home_url( $slug . $query_string . urlencode( $search_terms ) ), $search_terms ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bp_core_redirect( apply_filters( 'bp_core_search_site', $url, $search_terms ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressactivityentryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/activity/entry.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/activity/entry.php    2023-07-16 15:43:26 UTC (rev 13519)
+++ trunk/src/bp-templates/bp-legacy/buddypress/activity/entry.php      2023-07-17 09:01:08 UTC (rev 13520)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,7 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @package BuddyPress
</span><span class="cx" style="display: block; padding: 0 10px">  * @subpackage bp-legacy
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 3.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @version 10.0.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @version 12.0.0
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,7 +133,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                        ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input bp-suggestions" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                <input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> &nbsp; <a href="#" class="ac-reply-cancel"><?php _e( 'Cancel', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         <input type="submit" name="ac_form_submit" value="<?php esc_attr_e( 'Post', 'buddypress' ); ?>" /> &nbsp; <a href="<?php bp_activity_comment_cancel_url(); ?>" class="ac-reply-cancel"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress-functions.php 2023-07-16 15:43:26 UTC (rev 13519)
+++ trunk/src/bp-templates/bp-legacy/buddypress-functions.php   2023-07-17 09:01:08 UTC (rev 13520)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -934,7 +934,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        break;
</span><span class="cx" style="display: block; padding: 0 10px">                default:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $feed_url = home_url( bp_get_activity_root_slug() . '/feed/' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $feed_url = bp_rewrites_get_url(
+                               array(
+                                       'component_id'       => 'activity',
+                                       'single_item_action' => 'feed',
+                               )
+                       );
</ins><span class="cx" style="display: block; padding: 0 10px">                         break;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>