<!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] [2951] trunk: User join filters.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2951</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-04-24 17:14:47 +0000 (Sat, 24 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>User join filters.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<li><a href="#trunkbpcorebpcoreclassesphp">trunk/bp-core/bp-core-classes.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsclassesphp">trunk/bp-groups/bp-groups-classes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-classes.php (2950 => 2951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2010-04-24 15:34:25 UTC (rev 2950)
+++ trunk/bp-activity/bp-activity-classes.php        2010-04-24 17:14:47 UTC (rev 2951)
</span><span class="lines">@@ -130,9 +130,9 @@
</span><span class="cx"> 
</span><span class="cx">                 if ( $per_page &amp;&amp; $page ) {
</span><span class="cx">                         $pag_sql = $wpdb-&gt;prepare( &quot;LIMIT %d, %d&quot;, intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
</span><del>-                        $activities = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}&quot; ) );
</del><ins>+                        $activities = $wpdb-&gt;get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb-&gt;prepare( &quot;{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}&quot;, $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) ) );
</ins><span class="cx">                 } else
</span><del>-                        $activities = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}&quot; ) );
</del><ins>+                        $activities = $wpdb-&gt;get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb-&gt;prepare( &quot;{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}&quot;, $select_sql, $from_sql, $where_sql, $sort ) ) );
</ins><span class="cx"> 
</span><span class="cx">                 $total_activities = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT count(a.id) FROM {$bp-&gt;activity-&gt;table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}&quot; ) );
</span><span class="cx"> 
</span><span class="lines">@@ -366,7 +366,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Retrieve all descendants of the $root node */
</span><del>-                        $descendants = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp-&gt;activity-&gt;table_name} a, {$wpdb-&gt;users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC&quot;, $activity_id, $left, $right ) );
</del><ins>+                        $descendants = $wpdb-&gt;get_results( apply_filters( 'bp_activity_comments_user_join_filter', $wpdb-&gt;prepare( &quot;SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp-&gt;activity-&gt;table_name} a, {$wpdb-&gt;users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' AND a.item_id = %d AND a.mptt_left BETWEEN %d AND %d ORDER BY a.date_recorded ASC&quot;, $activity_id, $left, $right ), $activity_id, $left, $right ) );
</ins><span class="cx"> 
</span><span class="cx">                         /* Loop descendants and build an assoc array */
</span><span class="cx">                         foreach ( (array)$descendants as $d ) {
</span></span></pre></div>
<a id="trunkbpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-classes.php (2950 => 2951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-classes.php        2010-04-24 15:34:25 UTC (rev 2950)
+++ trunk/bp-core/bp-core-classes.php        2010-04-24 17:14:47 UTC (rev 2951)
</span><span class="lines">@@ -124,9 +124,6 @@
</span><span class="cx"> 
</span><span class="cx">                 $sql['from'] = &quot;FROM &quot; . CUSTOM_USER_TABLE . &quot; u LEFT JOIN &quot; . CUSTOM_USER_META_TABLE . &quot; um ON um.user_id = u.ID&quot;;
</span><span class="cx"> 
</span><del>-                if ( $search_terms &amp;&amp; bp_is_active( 'xprofile' ) || 'alphabetical' == $type )
-                        $sql['join_profiledata'] = &quot;LEFT JOIN {$bp-&gt;profile-&gt;table_name_data} pd ON u.ID = pd.user_id&quot;;
-
</del><span class="cx">                 $sql['where'] = 'WHERE ' . bp_core_get_status_sql( 'u.' );
</span><span class="cx"> 
</span><span class="cx">                 if ( 'active' == $type || 'online' == $type )
</span><span class="lines">@@ -163,9 +160,9 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( $search_terms &amp;&amp; bp_is_active( 'xprofile' ) ) {
</del><ins>+                if ( $search_terms ) {
</ins><span class="cx">                         $search_terms = like_escape( $wpdb-&gt;escape( $search_terms ) );
</span><del>-                        $sql['where_searchterms'] = &quot;AND pd.value LIKE '%%$search_terms%%'&quot;;
</del><ins>+                        $sql['where_searchterms'] = &quot;AND u.display_name LIKE '%%$search_terms%%'&quot;;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 switch ( $type ) {
</span><span class="lines">@@ -176,7 +173,7 @@
</span><span class="cx">                                 $sql[] = &quot;ORDER BY u.user_registered DESC&quot;;
</span><span class="cx">                                 break;
</span><span class="cx">                         case 'alphabetical':
</span><del>-                                $sql[] = &quot;ORDER BY pd.value ASC&quot;;
</del><ins>+                                $sql[] = &quot;ORDER BY u.display_name ASC&quot;;
</ins><span class="cx">                                 break;
</span><span class="cx">                         case 'random':
</span><span class="cx">                                 $sql[] = &quot;ORDER BY rand()&quot;;
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-classes.php (2950 => 2951)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php        2010-04-24 15:34:25 UTC (rev 2950)
+++ trunk/bp-groups/bp-groups-classes.php        2010-04-24 17:14:47 UTC (rev 2951)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">                         $this-&gt;is_member = BP_Groups_Member::check_is_member( $bp-&gt;loggedin_user-&gt;id, $this-&gt;id );
</span><span class="cx"> 
</span><span class="cx">                         /* Get group admins and mods */
</span><del>-                        $admin_mods = $wpdb-&gt;get_results( $wpdb-&gt;prepare( &quot;SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb-&gt;users} u, {$bp-&gt;groups-&gt;table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )&quot;, $this-&gt;id ) );
</del><ins>+                        $admin_mods = $wpdb-&gt;get_results( apply_filters( 'bp_group_admin_mods_user_join_filter', $wpdb-&gt;prepare( &quot;SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb-&gt;users} u, {$bp-&gt;groups-&gt;table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )&quot;, $this-&gt;id ), $this-&gt;id ) );
</ins><span class="cx">                         foreach( (array)$admin_mods as $user ) {
</span><span class="cx">                                 if ( (int)$user-&gt;is_admin )
</span><span class="cx">                                         $this-&gt;admins[] = $user;
</span></span></pre>
</div>
</div>

</body>
</html>