<!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][6940] trunk: Only pass BP-related cookies to BP AJAX queries.</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 { 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">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/6940">6940</a></dd>
<dt>Author</dt> <dd>r-a-y</dd>
<dt>Date</dt> <dd>2013-04-22 05:01:53 +0000 (Mon, 22 Apr 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Only pass BP-related cookies to BP AJAX queries.

Previously, we would pass all cookies to admin-ajax.php.  This could
potentially lead to a '414 Long Request' error because of the length of the
querystring, resulting in the AJAX request failing.

This commit only passes cookies with the 'bp-' prefix to admin-ajax.php,
thus limiting the length of the URI request.

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/4606">#4606</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbptemplatesbplegacyjsbuddypressjs">trunk/bp-templates/bp-legacy/js/buddypress.js</a></li>
<li><a href="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbptemplatesbplegacyjsbuddypressjs"></a>
<div class="modfile"><h4>Modified: trunk/bp-templates/bp-legacy/js/buddypress.js (6939 => 6940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-templates/bp-legacy/js/buddypress.js        2013-04-22 02:23:15 UTC (rev 6939)
+++ trunk/bp-templates/bp-legacy/js/buddypress.js        2013-04-22 05:01:53 UTC (rev 6940)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'post_update',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce_post_update': jq(&quot;#_wpnonce_post_update&quot;).val(),
</span><span class="cx">                         'content': content,
</span><span class="cx">                         'object': object,
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'activity_mark_' + type,
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'id': parent_id
</span><span class="cx">                         },
</span><span class="cx">                         function(response) {
</span><span class="lines">@@ -252,7 +252,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'delete_activity',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'id': id,
</span><span class="cx">                                 '_wpnonce': nonce
</span><span class="cx">                         },
</span><span class="lines">@@ -306,7 +306,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'activity_get_older_updates',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'page': oldest_page
</span><span class="cx">                         },
</span><span class="cx">                         function(response)
</span><span class="lines">@@ -422,7 +422,7 @@
</span><span class="cx"> 
</span><span class="cx">                         var ajaxdata = {
</span><span class="cx">                                 action: 'new_activity_comment',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce_new_activity_comment': jq(&quot;#_wpnonce_new_activity_comment&quot;).val(),
</span><span class="cx">                                 'comment_id': comment_id,
</span><span class="cx">                                 'form_id': form_id[2],
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'delete_activity_comment',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce': nonce,
</span><span class="cx">                                 'id': comment_id
</span><span class="cx">                         },
</span><span class="lines">@@ -772,7 +772,7 @@
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'groups_invite_user',
</span><span class="cx">                         'friend_action': friend_action,
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce': jq(&quot;#_wpnonce_invite_uninvite_user&quot;).val(),
</span><span class="cx">                         'friend_id': friend_id,
</span><span class="cx">                         'group_id': jq(&quot;#group_id&quot;).val()
</span><span class="lines">@@ -805,7 +805,7 @@
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'groups_invite_user',
</span><span class="cx">                         'friend_action': 'uninvite',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce': jq(&quot;#_wpnonce_invite_uninvite_user&quot;).val(),
</span><span class="cx">                         'friend_id': friend_id,
</span><span class="cx">                         'group_id': jq(&quot;#group_id&quot;).val()
</span><span class="lines">@@ -872,7 +872,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: action,
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'id': id,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -914,7 +914,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'addremove_friend',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'fid': fid,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -963,7 +963,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'joinleave_group',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'gid': gid,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -1020,7 +1020,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'messages_send_reply',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce': jq(&quot;#send_message_nonce&quot;).val(),
</span><span class="cx"> 
</span><span class="cx">                                 'content': jq(&quot;#message_content&quot;).val(),
</span><span class="lines">@@ -1306,7 +1306,7 @@
</span><span class="cx"> 
</span><span class="cx">         bp_ajax_request = jq.post( ajaxurl, {
</span><span class="cx">                 action: object + '_filter',
</span><del>-                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                'cookie': bp_get_cookies(),
</ins><span class="cx">                 'object': object,
</span><span class="cx">                 'filter': filter,
</span><span class="cx">                 'search_terms': search_terms,
</span><span class="lines">@@ -1354,7 +1354,7 @@
</span><span class="cx"> 
</span><span class="cx">         bp_ajax_request = jq.post( ajaxurl, {
</span><span class="cx">                 action: 'activity_widget_filter',
</span><del>-                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                'cookie': bp_get_cookies(),
</ins><span class="cx">                 '_wpnonce_activity_filter': jq(&quot;#_wpnonce_activity_filter&quot;).val(),
</span><span class="cx">                 'scope': scope,
</span><span class="cx">                 'filter': filter
</span><span class="lines">@@ -1448,6 +1448,31 @@
</span><span class="cx">         return;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* Returns a querystring of BP cookies (cookies beginning with 'bp-') */
+function bp_get_cookies() {
+        // get all cookies and split into an array
+        var allCookies   = document.cookie.split(&quot;;&quot;);
+
+        var bpCookies    = {};
+        var cookiePrefix = 'bp-';
+
+        // loop through cookies
+        for (var i = 0; i &lt; allCookies.length; i++) {
+                var cookie    = allCookies[i];
+                var delimiter = cookie.indexOf(&quot;=&quot;);
+                var name      = unescape( cookie.slice(0, delimiter) ).trim();
+                var value     = unescape( cookie.slice(delimiter + 1) );
+
+                // if BP cookie, store it
+                if ( name.indexOf(cookiePrefix) == 0 ) {
+                        bpCookies[name] = value;
+                }
+        }
+
+        // returns BP cookies as querystring
+        return encodeURIComponent( jq.param(bpCookies) );
+}
+
</ins><span class="cx"> /* ScrollTo plugin - just inline and minified */
</span><span class="cx"> ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)&gt;=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&amp;&amp;g.axis.length&gt;1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number
 ':case's
 tring':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&amp;&amp;c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&amp;&amp;/^\d+$/.test(attr[key]))attr[key]=attr[key]&lt;=0?0:Math.min(attr[key],max);if(!i&amp;&amp;g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&amp;&amp;function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){v
 ar c=b==
 'x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (6939 => 6940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2013-04-22 02:23:15 UTC (rev 6939)
+++ trunk/bp-themes/bp-default/_inc/global.js        2013-04-22 05:01:53 UTC (rev 6940)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'post_update',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce_post_update': jq(&quot;input#_wpnonce_post_update&quot;).val(),
</span><span class="cx">                         'content': content,
</span><span class="cx">                         'object': object,
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'activity_mark_' + type,
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'id': parent_id
</span><span class="cx">                         },
</span><span class="cx">                         function(response) {
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'delete_activity',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'id': id,
</span><span class="cx">                                 '_wpnonce': nonce
</span><span class="cx">                         },
</span><span class="lines">@@ -303,7 +303,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'activity_get_older_updates',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 'page': oldest_page
</span><span class="cx">                         },
</span><span class="cx">                         function(response)
</span><span class="lines">@@ -416,7 +416,7 @@
</span><span class="cx"> 
</span><span class="cx">                         var ajaxdata = {
</span><span class="cx">                                 action: 'new_activity_comment',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce_new_activity_comment': jq(&quot;input#_wpnonce_new_activity_comment&quot;).val(),
</span><span class="cx">                                 'comment_id': comment_id,
</span><span class="cx">                                 'form_id': form_id[2],
</span><span class="lines">@@ -488,7 +488,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'delete_activity_comment',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce': nonce,
</span><span class="cx">                                 'id': comment_id
</span><span class="cx">                         },
</span><span class="lines">@@ -760,7 +760,7 @@
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'groups_invite_user',
</span><span class="cx">                         'friend_action': friend_action,
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce': jq(&quot;input#_wpnonce_invite_uninvite_user&quot;).val(),
</span><span class="cx">                         'friend_id': friend_id,
</span><span class="cx">                         'group_id': jq(&quot;input#group_id&quot;).val()
</span><span class="lines">@@ -793,7 +793,7 @@
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'groups_invite_user',
</span><span class="cx">                         'friend_action': 'uninvite',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         '_wpnonce': jq(&quot;input#_wpnonce_invite_uninvite_user&quot;).val(),
</span><span class="cx">                         'friend_id': friend_id,
</span><span class="cx">                         'group_id': jq(&quot;input#group_id&quot;).val()
</span><span class="lines">@@ -860,7 +860,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: action,
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'id': id,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -902,7 +902,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'addremove_friend',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'fid': fid,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -951,7 +951,7 @@
</span><span class="cx"> 
</span><span class="cx">                 jq.post( ajaxurl, {
</span><span class="cx">                         action: 'joinleave_group',
</span><del>-                        'cookie': encodeURIComponent(document.cookie),
</del><ins>+                        'cookie': bp_get_cookies(),
</ins><span class="cx">                         'gid': gid,
</span><span class="cx">                         '_wpnonce': nonce
</span><span class="cx">                 },
</span><span class="lines">@@ -1008,7 +1008,7 @@
</span><span class="cx"> 
</span><span class="cx">                         jq.post( ajaxurl, {
</span><span class="cx">                                 action: 'messages_send_reply',
</span><del>-                                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                                'cookie': bp_get_cookies(),
</ins><span class="cx">                                 '_wpnonce': jq(&quot;input#send_message_nonce&quot;).val(),
</span><span class="cx"> 
</span><span class="cx">                                 'content': jq(&quot;#message_content&quot;).val(),
</span><span class="lines">@@ -1289,7 +1289,7 @@
</span><span class="cx"> 
</span><span class="cx">         bp_ajax_request = jq.post( ajaxurl, {
</span><span class="cx">                 action: object + '_filter',
</span><del>-                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                'cookie': bp_get_cookies(),
</ins><span class="cx">                 'object': object,
</span><span class="cx">                 'filter': filter,
</span><span class="cx">                 'search_terms': search_terms,
</span><span class="lines">@@ -1337,7 +1337,7 @@
</span><span class="cx"> 
</span><span class="cx">         bp_ajax_request = jq.post( ajaxurl, {
</span><span class="cx">                 action: 'activity_widget_filter',
</span><del>-                'cookie': encodeURIComponent(document.cookie),
</del><ins>+                'cookie': bp_get_cookies(),
</ins><span class="cx">                 '_wpnonce_activity_filter': jq(&quot;input#_wpnonce_activity_filter&quot;).val(),
</span><span class="cx">                 'scope': scope,
</span><span class="cx">                 'filter': filter
</span><span class="lines">@@ -1431,6 +1431,31 @@
</span><span class="cx">         return;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* Returns a querystring of BP cookies (cookies beginning with 'bp-') */
+function bp_get_cookies() {
+        // get all cookies and split into an array
+        var allCookies   = document.cookie.split(&quot;;&quot;);
+
+        var bpCookies    = {};
+        var cookiePrefix = 'bp-';
+
+        // loop through cookies
+        for (var i = 0; i &lt; allCookies.length; i++) {
+                var cookie    = allCookies[i];
+                var delimiter = cookie.indexOf(&quot;=&quot;);
+                var name      = unescape( cookie.slice(0, delimiter) ).trim();
+                var value     = unescape( cookie.slice(delimiter + 1) );
+
+                // if BP cookie, store it
+                if ( name.indexOf(cookiePrefix) == 0 ) {
+                        bpCookies[name] = value;
+                }
+        }
+
+        // returns BP cookies as querystring
+        return encodeURIComponent( jq.param(bpCookies) );
+}
+
</ins><span class="cx"> /* ScrollTo plugin - just inline and minified */
</span><span class="cx"> ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)&gt;=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&amp;&amp;g.axis.length&gt;1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number
 ':case's
 tring':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&amp;&amp;c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&amp;&amp;/^\d+$/.test(attr[key]))attr[key]=attr[key]&lt;=0?0:Math.min(attr[key],max);if(!i&amp;&amp;g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&amp;&amp;function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){v
 ar c=b==
 'x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>