<!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] [2487] trunk/bp-activity/bp-activity-templatetags.php:
Activity has_activities() loop fixes.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2487</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-31 10:21:48 +0000 (Sun, 31 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Activity has_activities() loop fixes.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivitytemplatetagsphp">trunk/bp-activity/bp-activity-templatetags.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivitytemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-templatetags.php (2486 => 2487)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2010-01-31 09:49:47 UTC (rev 2486)
+++ trunk/bp-activity/bp-activity-templatetags.php        2010-01-31 10:21:48 UTC (rev 2487)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx">         $search_terms = false;
</span><span class="cx">         $object = false;
</span><span class="cx">         $primary_id = false;
</span><ins>+        $display_comments = 'threaded';
</ins><span class="cx">
</span><span class="cx">         /* User filtering */
</span><span class="cx">         if ( !empty( $bp->displayed_user->id ) )
</span><span class="lines">@@ -134,6 +135,9 @@
</span><span class="cx">
</span><span class="cx">         /* User activity scope filtering */
</span><span class="cx">         if ( !empty( $user_id ) ) {
</span><ins>+                if ( empty( $bp->current_action ) || 'just-me' == $bp->current_action )
+                        $display_comments = 'stream';
+
</ins><span class="cx">                 switch ( $bp->current_action ) {
</span><span class="cx">                         case 'friends':
</span><span class="cx">                                 if ( function_exists( 'friends_get_friend_user_ids' ) )
</span><span class="lines">@@ -157,6 +161,7 @@
</span><span class="cx">                                 $user_id = false;
</span><span class="cx">                                 $search_terms = '@' . bp_core_get_username( $bp->displayed_user->id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login );
</span><span class="cx">                                 $show_hidden = ( bp_is_my_profile() ) ? 1 : 0;
</span><ins>+                                $display_comments = 'stream';
</ins><span class="cx">                                 break;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -171,15 +176,9 @@
</span><span class="cx">         if ( $bp->current_action == $bp->activity->slug )
</span><span class="cx">                 $include = $bp->action_variables[0];
</span><span class="cx">
</span><del>-        /* Support for basic filters in earlier BP versions. */
-        if ( isset( $_GET['afilter'] ) )
-                $filter = array( 'object' => $_GET['afilter'] );
-        else
-                $filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
-
</del><span class="cx">         /* Note: any params used for filtering can be a single value, or multiple values comma separated. */
</span><span class="cx">         $defaults = array(
</span><del>-                'display_comments' => 'threaded', // false for none, stream/threaded - show comments in the stream or threaded under items
</del><ins>+                'display_comments' => $display_comments, // false for none, stream/threaded - show comments in the stream or threaded under items
</ins><span class="cx">                 'include' => $include, // pass an activity_id or string of ID's comma separated
</span><span class="cx">                 'sort' => 'DESC', // sort DESC or ASC
</span><span class="cx">                 'page' => 1, // which page to load
</span><span class="lines">@@ -199,13 +198,19 @@
</span><span class="cx">         );
</span><span class="cx">
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><del>-        extract( $r, EXTR_SKIP );
</del><ins>+        extract( $r );
</ins><span class="cx">
</span><span class="cx">         if ( $max ) {
</span><span class="cx">                 if ( $per_page > $max )
</span><span class="cx">                         $per_page = $max;
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        /* Support for basic filters in earlier BP versions. */
+        if ( isset( $_GET['afilter'] ) )
+                $filter = array( 'object' => $_GET['afilter'] );
+        else
+                $filter = array( 'user_id' => $user_id, 'object' => $object, 'action' => $action, 'primary_id' => $primary_id, 'secondary_id' => $secondary_id );
+
</ins><span class="cx">         $activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
</span><span class="cx">
</span><span class="cx">         return apply_filters( 'bp_has_activities', $activities_template->has_activities(), &$activities_template );
</span></span></pre>
</div>
</div>
</body>
</html>