<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [2422] trunk: Fixes #1661</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2422</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-24 14:29:57 +0000 (Sun, 24 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixes #1661</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incajaxphp">trunk/bp-themes/bp-default/_inc/ajax.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#trunkbpthemesbpdefaultblogsblogsloopphp">trunk/bp-themes/bp-default/blogs/blogs-loop.php</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupsgroupsloopphp">trunk/bp-themes/bp-default/groups/groups-loop.php</a></li>
<li><a href="#trunkbpthemesbpdefaultmembersmembersloopphp">trunk/bp-themes/bp-default/members/members-loop.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-core/bp-core-templatetags.php        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -484,7 +484,7 @@
</span><span class="cx">                 else
</span><span class="cx">                         $link = $bp->displayed_user->domain . $user_nav_item['link'];
</span><span class="cx">
</span><del>-                echo apply_filters( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], '<li id="li-subnav-' . $user_nav_item['css_id'] . '" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item );
</del><ins>+                echo apply_filters( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], '<li id="' . $user_nav_item['css_id'] . '-personal" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">         /* DEPRECATED - use bp_get_displayed_user_nav() */
</span><span class="lines">@@ -531,7 +531,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         /* echo out the final list item */
</span><del>-                        echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="li-subnav-' . $subnav_item['css_id'] . '" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
</del><ins>+                        echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-personal-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 /* If we're using the classic template structure, show the displayed user nav instead */
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -9,15 +9,20 @@
</span><span class="cx"> * your own _inc/ajax.php file and add/remove AJAX functionality as you see fit.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-function bp_dtheme_content_filter() {
</del><ins>+function bp_dtheme_object_filter() {
</ins><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        $content = esc_attr( $_POST['content'] );
-        $type = esc_attr( $_POST['type'] );
</del><ins>+        $object = esc_attr( $_POST['object'] );
</ins><span class="cx">         $filter = esc_attr( $_POST['filter'] );
</span><span class="cx">         $page = esc_attr( $_POST['page'] );
</span><span class="cx">         $search_terms = esc_attr( $_POST['search_terms'] );
</span><span class="cx">
</span><ins>+        /**
+         * Scope is the scope of results to use, either all (everything) or personal (just mine).
+         * For example if the object is groups, it would be all groups, or just groups I belong to.
+         */
+        $scope = esc_attr( $_POST['scope'] );
+
</ins><span class="cx">         /* Plugins can pass extra parameters and use the bp_dtheme_ajax_querystring_content_filter filter to parse them */
</span><span class="cx">         $extras = esc_attr( $_POST['extras'] );
</span><span class="cx">
</span><span class="lines">@@ -28,27 +33,24 @@
</span><span class="cx">         if ( empty( $filter ) )
</span><span class="cx">                 $filter = 'active';
</span><span class="cx">
</span><del>-        if ( empty( $type ) )
-                $type = 'all';
-
</del><span class="cx">         $bp->ajax_querystring = 'type=' . $filter . '&page=' . $page;
</span><span class="cx">
</span><span class="cx">         if ( !empty( $search_terms ) )
</span><span class="cx">                 $bp->ajax_querystring .= '&search_terms=' . $search_terms;
</span><span class="cx">
</span><del>-        if ( $type != 'all' || $bp->displayed_user->id ) {
</del><ins>+        if ( $scope != 'all' || $bp->displayed_user->id ) {
</ins><span class="cx">                 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
</span><span class="cx">                 $bp->ajax_querystring .= '&user_id=' . $user_id;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_content_filter', $bp->ajax_querystring, $extras );
</span><span class="cx">
</span><del>-        locate_template( array( "$content/$content-loop.php" ), true );
</del><ins>+        locate_template( array( "$object/$object-loop.php" ), true );
</ins><span class="cx"> }
</span><del>-add_action( 'wp_ajax_members_filter', 'bp_dtheme_content_filter' );
-add_action( 'wp_ajax_groups_filter', 'bp_dtheme_content_filter' );
-add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_content_filter' );
-add_action( 'wp_ajax_forums_filter', 'bp_dtheme_content_filter' );
</del><ins>+add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_filter' );
+add_action( 'wp_ajax_groups_filter', 'bp_dtheme_object_filter' );
+add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_filter' );
+add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_filter' );
</ins><span class="cx">
</span><span class="cx"> function bp_dtheme_post_update() {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -11,20 +11,20 @@
</span><span class="cx">
</span><span class="cx">         /* Members */
</span><span class="cx">         if ( j('div.members').length )
</span><del>-                bp_filter_request( j.cookie('bp-members-type'), j.cookie('bp-members-filter'), 'members', 'div.members' );
</del><ins>+                bp_filter_request( 'members', j.cookie('bp-members-filter'), j.cookie('bp-members-scope'), 'div.members' );
</ins><span class="cx">
</span><span class="cx">         /* Groups */
</span><span class="cx">         if ( j('div.groups').length )
</span><del>-                bp_filter_request( j.cookie('bp-groups-type'), j.cookie('bp-groups-filter'), 'groups', 'div.groups' );
</del><ins>+                bp_filter_request( 'groups', j.cookie('bp-groups-filter'), j.cookie('bp-groups-scope'), 'div.groups' );
</ins><span class="cx">
</span><span class="cx">         /* Blogs */
</span><span class="cx">         if ( j('div.blogs').length )
</span><del>-                bp_filter_request( j.cookie('bp-blogs-type'), j.cookie('bp-blogs-filter'), 'blogs', 'div.blogs' );
</del><ins>+                bp_filter_request( 'blogs', j.cookie('bp-blogs-filter'), j.cookie('bp-blogs-scope'), 'div.blogs' );
</ins><span class="cx">
</span><span class="cx">         /* Forums */
</span><span class="cx">         if ( j('div.forums').length ) {
</span><span class="cx">                 j('div#new-topic-post').hide();
</span><del>-                bp_filter_request( j.cookie('bp-forums-type'), j.cookie('bp-forums-filter'), 'forums', 'div.forums' );
</del><ins>+                bp_filter_request( 'forums', j.cookie('bp-forums-filter'), j.cookie('bp-forums-scope'), 'div.forums' );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /* @message Compose Scrolling */
</span><span class="lines">@@ -534,7 +534,7 @@
</span><span class="cx">                         var css_id = j('div.item-list-tabs li.selected').attr('id').split( '-' );
</span><span class="cx">                         var object = css_id[0];
</span><span class="cx">
</span><del>-                        bp_filter_request( j.cookie('bp-' + object + '-type'), j.cookie('bp-' + object + '-filter'), object, 'div.' + object, 1, target.parent().children('label').children('input').val() );
</del><ins>+                        bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1 );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 return false;
</span><span class="lines">@@ -556,7 +556,7 @@
</span><span class="cx">                         if ( 'activity' == object )
</span><span class="cx">                                 return false;
</span><span class="cx">
</span><del>-                        var type = css_id[1];
</del><ins>+                        var scope = css_id[1];
</ins><span class="cx">                         var filter = j("#" + object + "-order-select select").val();
</span><span class="cx">                         var search_terms = j("#" + object + "_search").val();
</span><span class="cx">
</span><span class="lines">@@ -566,7 +566,7 @@
</span><span class="cx">                         });
</span><span class="cx">                         j('li#' + object + '-' + filter).addClass('selected');
</span><span class="cx">
</span><del>-                        bp_filter_request( type, filter, object, 'div.' + object, 1, search_terms );
</del><ins>+                        bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1 );
</ins><span class="cx">
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="lines">@@ -581,22 +581,22 @@
</span><span class="cx">
</span><span class="cx">                 var css_id = el.attr('id').split('-');
</span><span class="cx">                 var object = css_id[0];
</span><del>-                var type = css_id[1];
</del><ins>+                var scope = css_id[1];
</ins><span class="cx">                 var filter = j(this).val();
</span><span class="cx">                 var search_terms = j("#" + object + "_search").val();
</span><span class="cx">
</span><del>-                bp_filter_request( type, filter, object, 'div.' + object, 1, search_terms );
</del><ins>+                bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1 );
</ins><span class="cx">
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><span class="cx">
</span><span class="cx">         /* Filter the current content list (groups/members/blogs/topics) */
</span><del>-        function bp_filter_request( type, filter, id, target, page, search_terms, extras ) {
-                if ( 'activity' == id )
</del><ins>+        function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
+                if ( 'activity' == object )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><del>-                if ( null == type )
-                        var type = 'all';
</del><ins>+                if ( null == scope )
+                        var scope = 'all';
</ins><span class="cx">
</span><span class="cx">                 if ( null == filter )
</span><span class="cx">                         var filter = 'active';
</span><span class="lines">@@ -614,30 +614,30 @@
</span><span class="cx">                         search_terms = j.query.get('s');
</span><span class="cx">
</span><span class="cx">                 /* Save the type and filter to a session cookie */
</span><del>-                j.cookie( 'bp-' + id + '-type', type, null );
-                j.cookie( 'bp-' + id + '-filter', filter, null );
-                j.cookie( 'bp-' + id + '-page', page, null );
-                j.cookie( 'bp-' + id + '-search-terms', search_terms, null );
</del><ins>+                j.cookie( 'bp-' + object + '-scope', scope, null );
+                j.cookie( 'bp-' + object + '-filter', filter, null );
+                j.cookie( 'bp-' + object + '-page', page, null );
+                j.cookie( 'bp-' + object + '-search-terms', search_terms, null );
</ins><span class="cx">
</span><span class="cx">                 /* Set the correct selected nav and filter */
</span><span class="cx">                 j('div.item-list-tabs li').each( function() {
</span><span class="cx">                         j(this).removeClass('selected');
</span><span class="cx">                 });
</span><del>-                j('div.item-list-tabs li#' + id + '-' + type + ', div.item-list-tabs#object-nav li.current').addClass('selected');
</del><ins>+                j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
</ins><span class="cx">                 j('div.item-list-tabs li.selected').addClass('loading');
</span><span class="cx">                 j('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
</span><span class="cx">
</span><del>-                if ( 'friends' == id )
-                        id = 'members';
</del><ins>+                if ( 'friends' == object )
+                        object = 'members';
</ins><span class="cx">
</span><span class="cx">                 j.post( ajaxurl, {
</span><del>-                        action: id + '_filter',
</del><ins>+                        action: object + '_filter',
</ins><span class="cx">                         'cookie': encodeURIComponent(document.cookie),
</span><del>-                        'type': type,
</del><ins>+                        'object': object,
</ins><span class="cx">                         'filter': filter,
</span><ins>+                        'search_terms': search_terms,
+                        'scope': scope,
</ins><span class="cx">                         'page': page,
</span><del>-                        'content': id,
-                        'search_terms': search_terms,
</del><span class="cx">                         'extras': extras
</span><span class="cx">                 },
</span><span class="cx">                 function(response)
</span><span class="lines">@@ -679,7 +679,7 @@
</span><span class="cx">                         else
</span><span class="cx">                                 var page_number = Number( j(target).html() );
</span><span class="cx">
</span><del>-                        bp_filter_request( j.cookie('bp-' + object + '-type'), j.cookie('bp-' + object + '-filter'), object, 'div.' + object, page_number, j.cookie('bp-' + object + '-search-terms') );
</del><ins>+                        bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope'), 'div.' + object, j.cookie('bp-' + object + '-search-terms'), page_number );
</ins><span class="cx">
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultblogsblogsloopphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/blogs/blogs-loop.php (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/blogs/blogs-loop.php        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-themes/bp-default/blogs/blogs-loop.php        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
</del><ins>+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
</ins><span class="cx">
</span><span class="cx"> <?php do_action( 'bp_before_blogs_loop' ) ?>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupsgroupsloopphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/groups-loop.php (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/groups-loop.php        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-themes/bp-default/groups/groups-loop.php        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
</del><ins>+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
</ins><span class="cx">
</span><span class="cx"> <?php do_action( 'bp_before_groups_loop' ) ?>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultmembersmembersloopphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/members/members-loop.php (2421 => 2422)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/members/members-loop.php        2010-01-24 14:11:09 UTC (rev 2421)
+++ trunk/bp-themes/bp-default/members/members-loop.php        2010-01-24 14:29:57 UTC (rev 2422)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
</del><ins>+<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
</ins><span class="cx">
</span><span class="cx"> <?php do_action( 'bp_before_members_loop' ) ?>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>