<!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] [2666] trunk:
Make sure activity comments are separating their action an content and also being hidden publicly if on a private activity
.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2666</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-11 12:50:00 +0000 (Thu, 11 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make sure activity comments are separating their action an content and also being hidden publicly if on a private activity.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivitytemplatetagsphp">trunk/bp-activity/bp-activity-templatetags.php</a></li>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incajaxphp">trunk/bp-themes/bp-default/_inc/ajax.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 (2665 => 2666)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2010-02-11 11:54:44 UTC (rev 2665)
+++ trunk/bp-activity/bp-activity-templatetags.php        2010-02-11 12:50:00 UTC (rev 2666)
</span><span class="lines">@@ -190,6 +190,8 @@
</span><span class="cx">                 if ( 'just-me' == $scope )
</span><span class="cx">                         $display_comments = 'stream';
</span><span class="cx">
</span><ins>+                $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
+
</ins><span class="cx">                 if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id ) {
</span><span class="cx">                         switch ( $scope ) {
</span><span class="cx">                                 case 'friends':
</span><span class="lines">@@ -208,7 +210,7 @@
</span><span class="cx">
</span><span class="cx">                                                 $object = $bp->groups->id;
</span><span class="cx">                                                 $primary_id = implode( ',', (array)$groups['groups'] );
</span><del>-                                                $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
</del><ins>+
</ins><span class="cx">                                                 $user_id = false;
</span><span class="cx">                                         }
</span><span class="cx">                                         break;
</span><span class="lines">@@ -218,13 +220,11 @@
</span><span class="cx">                                                 return false;
</span><span class="cx">
</span><span class="cx">                                         $include = implode( ',', (array)$favs );
</span><del>-                                        $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
</del><span class="cx">                                         break;
</span><span class="cx">                                 case 'mentions':
</span><span class="cx">                                         $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;
</span><span class="cx">                                         $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
</span><span class="cx">                                         $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login );
</span><del>-                                        $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0;
</del><span class="cx">                                         $display_comments = 'stream';
</span><span class="cx">                                         $user_id = false;
</span><span class="cx">                                         break;
</span><span class="lines">@@ -570,6 +570,8 @@
</span><span class="cx">                                 if ( !$comment->user_fullname )
</span><span class="cx">                                         $comment->user_fullname = $comment->display_name;
</span><span class="cx">
</span><ins>+                                var_dump($comment->content);
+
</ins><span class="cx">                                 $content .= '<li id="acomment-' . $comment->id . '">';
</span><span class="cx">                                 $content .= '<div class="acomment-avatar"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 25, 'height' => 25, 'email' => $comment->user_email ) ) . '</a></div>';
</span><span class="cx">                                 $content .= '<div class="acomment-meta"><a href="' . bp_core_get_user_domain( $comment->user_id, $comment->user_nicename, $comment->user_login ) . '">' . apply_filters( 'bp_get_member_name', $comment->user_fullname ) . '</a> &middot; ' . sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( strtotime( $comment->date_recorded ) ) );
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2665 => 2666)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2010-02-11 11:54:44 UTC (rev 2665)
+++ trunk/bp-activity.php        2010-02-11 12:50:00 UTC (rev 2666)
</span><span class="lines">@@ -626,18 +626,20 @@
</span><span class="cx">         if ( empty($parent_id) )
</span><span class="cx">                 $parent_id = $activity_id;
</span><span class="cx">
</span><del>-        /* Insert the "user posted a new activity comment header text" */
-        $comment_header = '<div class="comment-header">' . sprintf( __( '%s posted a new activity comment:', 'buddypress' ), bp_core_get_userlink( $user_id ) ) . ' <span class="time-since">%s</span></div> ';
</del><ins>+        /* Check to see if the parent activity is hidden, and if so, hide this comment publically. */
+        $activity = new BP_Activity_Activity( $activity_id );
+        $is_hidden = ( (int)$activity->hide_sitewide ) ? 1 : 0;
</ins><span class="cx">
</span><span class="cx">         /* Insert the activity comment */
</span><span class="cx">         $comment_id = bp_activity_add( array(
</span><del>-                'content' => apply_filters( 'bp_activity_comment_content', $comment_header . '<div class="activity-inner">' . $content . '</div>' ),
-                'primary_link' => '',
</del><ins>+                'action' => apply_filters( 'bp_activity_comment_action', sprintf( __( '%s posted a new activity comment:', 'buddypress' ), bp_core_get_userlink( $user_id ) ) ),
+                'content' => apply_filters( 'bp_activity_comment_content', '<div class="activity-inner">' . $content . '</div>' ),
</ins><span class="cx">                 'component' => $bp->activity->id,
</span><span class="cx">                 'type' => 'activity_comment',
</span><span class="cx">                 'user_id' => $user_id,
</span><span class="cx">                 'item_id' => $activity_id,
</span><del>-                'secondary_item_id' => $parent_id
</del><ins>+                'secondary_item_id' => $parent_id,
+                'hide_sitewide' => $is_hidden
</ins><span class="cx">         ) );
</span><span class="cx">
</span><span class="cx">         /* Send an email notification if settings allow */
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (2665 => 2666)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2010-02-11 11:54:44 UTC (rev 2665)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2010-02-11 12:50:00 UTC (rev 2666)
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx">                                 </div>
</span><span class="cx">
</span><span class="cx">                                 <div class="acomment-content">
</span><del>-                                        <?php bp_activity_content() ?>
</del><ins>+                                        <?php bp_activity_content_body() ?>
</ins><span class="cx">                                 </div>
</span><span class="cx">                         </li>
</span><span class="cx">                 <?php endwhile; ?>
</span></span></pre>
</div>
</div>
</body>
</html>