<!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] [2923] branches/1.2: Fix incorrect hooks in template.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2923</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-04-14 17:01:52 +0000 (Wed, 14 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix incorrect hooks in template. Fix issues with ordering when getting specific users via the members loop.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpcorebpcoreclassesphp">branches/1.2/bp-core/bp-core-classes.php</a></li>
<li><a href="#branches12bpcorebpcoretemplatetagsphp">branches/1.2/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#branches12bpcorebpcorewpabstractionphp">branches/1.2/bp-core/bp-core-wpabstraction.php</a></li>
<li><a href="#branches12bpcorephp">branches/1.2/bp-core.php</a></li>
<li><a href="#branches12bpthemesbpdefaultmemberssinglehomephp">branches/1.2/bp-themes/bp-default/members/single/home.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-classes.php (2922 => 2923)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-classes.php        2010-04-14 13:13:02 UTC (rev 2922)
+++ branches/1.2/bp-core/bp-core-classes.php        2010-04-14 17:01:52 UTC (rev 2923)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx">         /* Static Functions */
</span><span class="cx"> 
</span><del>-        function get_users( $type, $limit = null, $page = 1, $user_id = false, $search_terms = false, $populate_extras = true ) {
</del><ins>+        function get_users( $type, $limit = null, $page = 1, $user_id = false, $include = false, $search_terms = false, $populate_extras = true ) {
</ins><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span><span class="cx">                 $sql = array();
</span><span class="lines">@@ -153,6 +153,19 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+                if ( $include ) {
+                        /* Unset previous user restriction SQL */
+                        unset( $sql['where_friends'] );
+
+                        if ( is_array( $include ) )
+                                $uids = $wpdb-&gt;escape( implode( ',', (array)$include ) );
+                        else
+                                $uids = $wpdb-&gt;escape( $include );
+
+                        if ( !empty( $uids ) )
+                                $sql['where_users'] = &quot;AND u.ID IN ({$uids})&quot;;
+                }
+
</ins><span class="cx">                 if ( $search_terms &amp;&amp; function_exists( 'xprofile_install' ) ) {
</span><span class="cx">                         $search_terms = like_escape( $wpdb-&gt;escape( $search_terms ) );
</span><span class="cx">                         $sql['where_searchterms'] = &quot;AND pd.value LIKE '%%$search_terms%%'&quot;;
</span><span class="lines">@@ -253,34 +266,6 @@
</span><span class="cx">                 return array( 'users' =&gt; $paged_users, 'total' =&gt; $total_users );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extras = true ) {
-                global $wpdb, $bp;
-
-                if ( $limit &amp;&amp; $page )
-                        $pag_sql = $wpdb-&gt;prepare( &quot; LIMIT %d, %d&quot;, intval( ( $page - 1 ) * $limit), intval( $limit ) );
-
-                $user_sql = &quot; AND user_id IN ( &quot; . $wpdb-&gt;escape( $user_ids ) . &quot; ) &quot;;
-                $status_sql = bp_core_get_status_sql();
-
-                $total_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', $wpdb-&gt;prepare( &quot;SELECT COUNT(DISTINCT ID) FROM &quot; . CUSTOM_USER_TABLE . &quot; WHERE {$status_sql} AND ID IN ( &quot; . $wpdb-&gt;escape( $user_ids ) . &quot; ) &quot; ), $wpdb-&gt;escape( $user_ids ) );
-                $paged_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', $wpdb-&gt;prepare( &quot;SELECT DISTINCT ID as id, user_registered, user_nicename, user_login, user_email FROM &quot; . CUSTOM_USER_TABLE . &quot; WHERE {$status_sql} AND ID IN ( &quot; . $wpdb-&gt;escape( $user_ids ) . &quot; ) {$pag_sql}&quot; ), $wpdb-&gt;escape( $user_ids ) );
-
-                $total_users = $wpdb-&gt;get_var( $total_users_sql );
-                $paged_users = $wpdb-&gt;get_results( $paged_users_sql );
-
-                /***
-                 * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.
-                 * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
-                 */
-
-                /* Add additional data to the returned results */
-                if ( $populate_extras )
-                        $paged_users = BP_Core_User::get_user_extras( &amp;$paged_users, &amp;$user_ids );
-
-
-                return array( 'users' =&gt; $paged_users, 'total' =&gt; $total_users );
-        }
-
</del><span class="cx">         function search_users( $search_terms, $limit = null, $page = 1, $populate_extras = true ) {
</span><span class="cx">                 global $wpdb, $bp;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-templatetags.php (2922 => 2923)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-templatetags.php        2010-04-14 13:13:02 UTC (rev 2922)
+++ branches/1.2/bp-core/bp-core-templatetags.php        2010-04-14 17:01:52 UTC (rev 2923)
</span><span class="lines">@@ -26,13 +26,9 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( isset( $_REQUEST['letter'] ) &amp;&amp; '' != $_REQUEST['letter'] ) {
</span><span class="cx">                         $this-&gt;members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this-&gt;pag_num, $this-&gt;pag_page, $populate_extras );
</span><ins>+                } else {
+                        $this-&gt;members = bp_core_get_users( array( 'type' =&gt; $this-&gt;type, 'per_page' =&gt; $this-&gt;pag_num, 'page' =&gt; $this-&gt;pag_page, 'user_id' =&gt; $user_id, 'include' =&gt; $include, 'search_terms' =&gt; $search_terms, 'populate_extras' =&gt; $populate_extras ) );
</ins><span class="cx">                 }
</span><del>-                else if ( false !== $include ) {
-                        $this-&gt;members = BP_Core_User::get_specific_users( $include, $this-&gt;pag_num, $this-&gt;pag_page, $populate_extras );
-                }
-                else {
-                        $this-&gt;members = bp_core_get_users( array( 'type' =&gt; $this-&gt;type, 'per_page' =&gt; $this-&gt;pag_num, 'page' =&gt; $this-&gt;pag_page, 'user_id' =&gt; $user_id, 'search_terms' =&gt; $search_terms, 'populate_extras' =&gt; $populate_extras ) );
-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !$max || $max &gt;= (int)$this-&gt;members['total'] )
</span><span class="cx">                         $this-&gt;total_member_count = (int)$this-&gt;members['total'];
</span><span class="lines">@@ -159,8 +155,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $members_template = new BP_Core_Members_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool)$populate_extras );
</span><del>-
-        return $members_template-&gt;has_members();
</del><ins>+        return apply_filters( 'bp_has_members', $members_template-&gt;has_members(), &amp;$members_template );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_the_member() {
</span></span></pre></div>
<a id="branches12bpcorebpcorewpabstractionphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-wpabstraction.php (2922 => 2923)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-wpabstraction.php        2010-04-14 13:13:02 UTC (rev 2922)
+++ branches/1.2/bp-core/bp-core-wpabstraction.php        2010-04-14 17:01:52 UTC (rev 2923)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( !function_exists( 'is_site_admin' ) ) {
</span><del>-        function is_site_admin() {
</del><ins>+        function is_site_admin( $user_id = false ) {
</ins><span class="cx">                 if ( current_user_can( 'manage_options' ) )
</span><span class="cx">                         return true;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpcorephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core.php (2922 => 2923)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core.php        2010-04-14 13:13:02 UTC (rev 2922)
+++ branches/1.2/bp-core.php        2010-04-14 17:01:52 UTC (rev 2923)
</span><span class="lines">@@ -531,6 +531,7 @@
</span><span class="cx">                 'user_id' =&gt; false, // Pass a user_id to limit to only friend connections for this user
</span><span class="cx">                 'search_terms' =&gt; false, // Limit to users that match these search terms
</span><span class="cx"> 
</span><ins>+                'include' =&gt; false, // Pass comma separated list of user_ids to limit to only these users
</ins><span class="cx">                 'per_page' =&gt; 20, // The number of results to return per page
</span><span class="cx">                 'page' =&gt; 1, // The page to return if limiting per page
</span><span class="cx">                 'populate_extras' =&gt; true, // Fetch the last active, where the user is a friend, total friend count, latest update
</span><span class="lines">@@ -539,7 +540,7 @@
</span><span class="cx">         $params = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $params, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-        return apply_filters( 'bp_core_get_users', BP_Core_User::get_users( $type, $per_page, $page, $user_id, $search_terms, $populate_extras ), &amp;$params );
</del><ins>+        return apply_filters( 'bp_core_get_users', BP_Core_User::get_users( $type, $per_page, $page, $user_id, $include, $search_terms, $populate_extras ), &amp;$params );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="branches12bpthemesbpdefaultmemberssinglehomephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/members/single/home.php (2922 => 2923)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/members/single/home.php        2010-04-14 13:13:02 UTC (rev 2922)
+++ branches/1.2/bp-themes/bp-default/members/single/home.php        2010-04-14 17:01:52 UTC (rev 2923)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">                                         &lt;ul&gt;
</span><span class="cx">                                                 &lt;?php bp_get_displayed_user_nav() ?&gt;
</span><span class="cx"> 
</span><del>-                                                &lt;?php do_action( 'bp_members_directory_member_types' ) ?&gt;
</del><ins>+                                                &lt;?php do_action( 'bp_member_options_nav' ) ?&gt;
</ins><span class="cx">                                         &lt;/ul&gt;
</span><span class="cx">                                 &lt;/div&gt;
</span><span class="cx">                         &lt;/div&gt;&lt;!-- #item-nav --&gt;
</span></span></pre>
</div>
</div>

</body>
</html>