<!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] [2460] trunk: Fixed forum post activity tracking,
  now links directly to the forum post.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2460</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-26 17:49:48 +0000 (Tue, 26 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixed forum post activity tracking, now links directly to the forum post. Only show post form on the last page of posts.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsphp">trunk/bp-blogs.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpforumsbpforumstemplatetagsphp">trunk/bp-forums/bp-forums-templatetags.php</a></li>
<li><a href="#trunkbpfriendsphp">trunk/bp-friends.php</a></li>
<li><a href="#trunkbpgroupsphp">trunk/bp-groups.php</a></li>
<li><a href="#trunkbpthemesbpdefault_inccssdefaultcss">trunk/bp-themes/bp-default/_inc/css/default.css</a></li>
<li><a href="#trunkbpthemesbpdefault_incglobaljs">trunk/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupssingleforumtopicphp">trunk/bp-themes/bp-default/groups/single/forum/topic.php</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupssingleforumphp">trunk/bp-themes/bp-default/groups/single/forum.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-blogs.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -252,6 +252,7 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><ins>+                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="lines">@@ -277,7 +278,7 @@
</span><span class="cx">                 'secondary_item_id' =&gt; $secondary_item_id
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><del>-        return bp_activity_add( array( 'id' =&gt; $id, 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'hide_sitewide' =&gt; $hide_sitewide ) );
</del><ins>+        return bp_activity_add( array( 'id' =&gt; $id, 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'recorded_time' =&gt; $recorded_time, 'hide_sitewide' =&gt; $hide_sitewide ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_blogs_delete_activity( $args = true ) {
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-core/bp-core-templatetags.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -252,7 +252,7 @@
</span><span class="cx">         function bp_get_member_last_active() {
</span><span class="cx">                 global $members_template;
</span><span class="cx"> 
</span><del>-                $last_activity = attribute_escape( bp_core_get_last_activity( $members_template-&gt;member-&gt;last_activity, __( 'active %s ago', 'buddypress' ) ) );
</del><ins>+                $last_activity = bp_core_get_last_activity( $members_template-&gt;member-&gt;last_activity, __( 'active %s ago', 'buddypress' ) );
</ins><span class="cx"> 
</span><span class="cx">                 return apply_filters( 'bp_member_last_active', $last_activity );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-core.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -1462,13 +1462,7 @@
</span><span class="cx">         if ( !$last_activity_date || empty( $last_activity_date ) ) {
</span><span class="cx">                 $last_active = __( 'not recently active', 'buddypress' );
</span><span class="cx">         } else {
</span><del>-                if ( strstr( $last_activity_date, '-' ) ) {
-                        $last_active = bp_core_time_since( strtotime( $last_activity_date ) );
-                } else {
-                        $last_active = bp_core_time_since( $last_activity_date );
-                }
-
-                $last_active = sprintf( $string, $last_active );
</del><ins>+                $last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );
</span></span></pre></div>
<a id="trunkbpforumsbpforumstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-templatetags.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-templatetags.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-forums/bp-forums-templatetags.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -737,6 +737,7 @@
</span><span class="cx">                         'next_text' =&gt; '&amp;rarr;',
</span><span class="cx">                         'mid_size' =&gt; 1
</span><span class="cx">                 ));
</span><ins>+                $this-&gt;pag-&gt;total_pages = ceil($this-&gt;total_post_count / $this-&gt;pag_num);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_posts() {
</span><span class="lines">@@ -913,9 +914,12 @@
</span><span class="cx">                 $r = wp_parse_args( $args, $defaults );
</span><span class="cx">                 extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-                $links  = '&lt;a href=&quot;' . wp_nonce_url( bp_get_the_topic_permalink() . $topic_template-&gt;post-&gt;id . 'edit/post/' . $topic_template-&gt;post-&gt;post_id, 'bp_forums_edit_post' ) . '&quot;&gt;' . __( 'Edit Post', 'buddypress' ) . '&lt;/a&gt; ' . $seperator . ' ';
-                $links .= '&lt;a class=&quot;confirm&quot; id=&quot;post-delete-link&quot; href=&quot;' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template-&gt;post-&gt;post_id, 'bp_forums_delete_post' ) . '&quot;&gt;' . __( 'Delete Post', 'buddypress' ) . '&lt;/a&gt;';
</del><ins>+                if ( $_SERVER['QUERY_STRING'] )
+                        $query_vars = '?' . $_SERVER['QUERY_STRING'];
</ins><span class="cx"> 
</span><ins>+                $links  = '&lt;a href=&quot;' . wp_nonce_url( bp_get_the_topic_permalink() . $topic_template-&gt;post-&gt;id . 'edit/post/' . $topic_template-&gt;post-&gt;post_id . '/' . $query_vars, 'bp_forums_edit_post' ) . '&quot;&gt;' . __( 'Edit', 'buddypress' ) . '&lt;/a&gt; ' . $seperator . ' ';
+                $links .= '&lt;a class=&quot;confirm&quot; id=&quot;post-delete-link&quot; href=&quot;' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template-&gt;post-&gt;post_id, 'bp_forums_delete_post' ) . '&quot;&gt;' . __( 'Delete', 'buddypress' ) . '&lt;/a&gt; | ';
+
</ins><span class="cx">                 return $links;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -950,6 +954,15 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_the_topic_is_last_page() {
+        echo bp_get_the_topic_is_last_page();
+}
+        function bp_get_the_topic_is_last_page() {
+                global $topic_template;
+
+                return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template-&gt;pag_page == $topic_template-&gt;pag-&gt;total_pages );
+        }
+
</ins><span class="cx"> function bp_directory_forums_search_form() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpfriendsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-friends.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -275,13 +275,14 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><ins>+                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-        return bp_activity_add( array( 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'hide_sitewide' =&gt; $hide_sitewide ) );
</del><ins>+        return bp_activity_add( array( 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'recorded_time' =&gt; $recorded_time, 'hide_sitewide' =&gt; $hide_sitewide ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function friends_delete_activity( $args ) {
</span></span></pre></div>
<a id="trunkbpgroupsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-groups.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx">                                 if ( !is_site_admin() &amp;&amp; 'public' == $bp-&gt;groups-&gt;current_group-&gt;status &amp;&amp; !groups_is_user_member( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;groups-&gt;current_group-&gt;id ) )
</span><span class="cx">                                         groups_join_group( $bp-&gt;groups-&gt;current_group-&gt;id, $bp-&gt;loggedin_user-&gt;id );
</span><span class="cx"> 
</span><del>-                                if ( !groups_new_group_forum_post( $_POST['reply_text'], $topic_id ) )
</del><ins>+                                if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
</ins><span class="cx">                                         bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
</span><span class="cx">                                 else
</span><span class="cx">                                         bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
</span><span class="lines">@@ -382,7 +382,7 @@
</span><span class="cx">                                 if ( $_SERVER['QUERY_STRING'] )
</span><span class="cx">                                         $query_vars = '?' . $_SERVER['QUERY_STRING'];
</span><span class="cx"> 
</span><del>-                                bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars );
</del><ins>+                                bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         /* Sticky a topic */
</span><span class="lines">@@ -521,13 +521,16 @@
</span><span class="cx">                                         /* Check the nonce */
</span><span class="cx">                                         check_admin_referer( 'bp_forums_edit_post' );
</span><span class="cx"> 
</span><del>-                                        if ( !groups_update_group_forum_post( $post_id, $_POST['post_text'], $topic_id ) )
</del><ins>+                                        if ( !$post_id = groups_update_group_forum_post( $post_id, $_POST['post_text'], $topic_id, $_GET['topic_page'] ) )
</ins><span class="cx">                                                 bp_core_add_message( __( 'There was an error when editing that post', 'buddypress'), 'error' );
</span><span class="cx">                                         else
</span><span class="cx">                                                 bp_core_add_message( __( 'The post was edited successfully', 'buddypress') );
</span><span class="cx"> 
</span><ins>+                                        if ( $_SERVER['QUERY_STRING'] )
+                                                $query_vars = '?' . $_SERVER['QUERY_STRING'];
+
</ins><span class="cx">                                         do_action( 'groups_edit_forum_post', $post_id );
</span><del>-                                        bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic_slug . '/' );
</del><ins>+                                        bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
</ins><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="cx">                                 bp_core_load_template( apply_filters( 'groups_template_group_forum_topic_edit', 'groups/single/home' ) );
</span><span class="lines">@@ -1317,6 +1320,7 @@
</span><span class="cx">                 $hide_sitewide = true;
</span><span class="cx"> 
</span><span class="cx">         $defaults = array(
</span><ins>+                'id' =&gt; false,
</ins><span class="cx">                 'user_id' =&gt; $bp-&gt;loggedin_user-&gt;id,
</span><span class="cx">                 'action' =&gt; '',
</span><span class="cx">                 'content' =&gt; '',
</span><span class="lines">@@ -1325,13 +1329,14 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><ins>+                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</ins><span class="cx">                 'hide_sitewide' =&gt; $hide_sitewide
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-        return bp_activity_add( array( 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'hide_sitewide' =&gt; $hide_sitewide ) );
</del><ins>+        return bp_activity_add( array( 'id' =&gt; $id, 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'recorded_time' =&gt; $recorded_time, 'hide_sitewide' =&gt; $hide_sitewide ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function groups_update_last_activity( $group_id ) {
</span><span class="lines">@@ -1928,7 +1933,7 @@
</span><span class="cx">         do_action( 'groups_new_group_forum', $forum, $group_id );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function groups_new_group_forum_post( $post_text, $topic_id ) {
</del><ins>+function groups_new_group_forum_post( $post_text, $topic_id, $page = false ) {
</ins><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         if ( empty( $post_text ) )
</span><span class="lines">@@ -1937,25 +1942,29 @@
</span><span class="cx">         $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
</span><span class="cx">         $topic_id = apply_filters( 'group_forum_post_topic_id_before_save', $topic_id );
</span><span class="cx"> 
</span><del>-        if ( $forum_post = bp_forums_insert_post( array( 'post_text' =&gt; $post_text, 'topic_id' =&gt; $topic_id ) ) ) {
</del><ins>+        if ( $post_id = bp_forums_insert_post( array( 'post_text' =&gt; $post_text, 'topic_id' =&gt; $topic_id ) ) ) {
</ins><span class="cx">                 $topic = bp_forums_get_topic_details( $topic_id );
</span><span class="cx"> 
</span><span class="cx">                 $activity_action = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $bp-&gt;loggedin_user-&gt;id ), '&lt;a href=&quot;' . bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic-&gt;topic_slug .'/&quot;&gt;' . attribute_escape( $topic-&gt;topic_title ) . '&lt;/a&gt;', '&lt;a href=&quot;' . bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . '&quot;&gt;' . attribute_escape( $bp-&gt;groups-&gt;current_group-&gt;name ) . '&lt;/a&gt;' );
</span><span class="cx">                 $activity_content = '&lt;blockquote&gt;' . bp_create_excerpt( $post_text ) . '&lt;/blockquote&gt;';
</span><ins>+                $primary_link = bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic-&gt;topic_slug . '/';
</ins><span class="cx"> 
</span><ins>+                if ( $page )
+                        $primary_link .= &quot;?topic_page=&quot; . $page;
+
</ins><span class="cx">                 /* Record this in activity streams */
</span><span class="cx">                 groups_record_activity( array(
</span><del>-                        'action' =&gt; apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_text, &amp;$topic, &amp;$forum_post ),
-                        'content' =&gt; apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_text, &amp;$topic, &amp;$forum_post ),
-                        'primary_link' =&gt; apply_filters( 'groups_activity_new_forum_post_primary_link', bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic-&gt;topic_slug . '/' ),
</del><ins>+                        'action' =&gt; apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_id, $post_text, &amp;$topic ),
+                        'content' =&gt; apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_id, $post_text, &amp;$topic ),
+                        'primary_link' =&gt; apply_filters( 'groups_activity_new_forum_post_primary_link', &quot;{$primary_link}#post-{$post_id}&quot; ),
</ins><span class="cx">                         'type' =&gt; 'new_forum_post',
</span><span class="cx">                         'item_id' =&gt; $bp-&gt;groups-&gt;current_group-&gt;id,
</span><del>-                        'secondary_item_id' =&gt; $forum_post
</del><ins>+                        'secondary_item_id' =&gt; $post_id
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><del>-                do_action( 'groups_new_forum_topic_post', $bp-&gt;groups-&gt;current_group-&gt;id, $forum_post );
</del><ins>+                do_action( 'groups_new_forum_topic_post', $bp-&gt;groups-&gt;current_group-&gt;id, $post_id );
</ins><span class="cx"> 
</span><del>-                return $forum_post;
</del><ins>+                return $post_id;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="lines">@@ -2019,18 +2028,18 @@
</span><span class="cx">                         'item_id' =&gt; (int)$bp-&gt;groups-&gt;current_group-&gt;id,
</span><span class="cx">                         'user_id' =&gt; (int)$topic-&gt;topic_poster,
</span><span class="cx">                         'secondary_item_id' =&gt; $topic-&gt;topic_id,
</span><del>-                        'recorded_time' =&gt; strtotime( $topic-&gt;topic_time )
</del><ins>+                        'recorded_time' =&gt; $topic-&gt;topic_time
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action( 'groups_update_group_forum_topic', &amp;$topic );
</span><span class="cx"> 
</span><del>-                return true;
</del><ins>+                return $topic;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function groups_update_group_forum_post( $post_id, $post_text, $topic_id ) {
</del><ins>+function groups_update_group_forum_post( $post_id, $post_text, $topic_id, $page = false ) {
</ins><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         $post_text = apply_filters( 'group_forum_post_text_before_save', $post_text );
</span><span class="lines">@@ -2041,28 +2050,33 @@
</span><span class="cx">         if ( $post_id = bp_forums_insert_post( array( 'post_id' =&gt; $post_id, 'post_text' =&gt; $post_text, 'post_time' =&gt; $post-&gt;post_time, 'topic_id' =&gt; $topic_id, 'poster_id' =&gt; $post-&gt;poster_id ) ) ) {
</span><span class="cx">                 $topic = bp_forums_get_topic_details( $topic_id );
</span><span class="cx"> 
</span><del>-                /* Update the activity stream item */
-                if ( function_exists( 'bp_activity_delete_by_item_id' ) )
-                        bp_activity_delete_by_item_id( array( 'item_id' =&gt; $bp-&gt;groups-&gt;current_group-&gt;id, 'secondary_item_id' =&gt; $post_id, 'component' =&gt; $bp-&gt;groups-&gt;id, 'type' =&gt; 'new_forum_post' ) );
-
</del><span class="cx">                 $activity_action = sprintf( __( '%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink( $post-&gt;poster_id ), '&lt;a href=&quot;' . bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic-&gt;topic_slug .'&quot;&gt;' . attribute_escape( $topic-&gt;topic_title ) . '&lt;/a&gt;', '&lt;a href=&quot;' . bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . '&quot;&gt;' . attribute_escape( $bp-&gt;groups-&gt;current_group-&gt;name ) . '&lt;/a&gt;' );
</span><span class="cx">                 $activity_content = '&lt;blockquote&gt;' . bp_create_excerpt( $post_text ) . '&lt;/blockquote&gt;';
</span><ins>+                $primary_link = bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . 'forum/topic/' . $topic-&gt;topic_slug . '/';
</ins><span class="cx"> 
</span><del>-                /* Record this in activity streams */
</del><ins>+                if ( $page )
+                        $primary_link .= &quot;?topic_page=&quot; . $page;
+
+                /* Fetch an existing entry and update if one exists. */
+                if ( function_exists( 'bp_activity_get_activity_id' ) )
+                        $id = bp_activity_get_activity_id( array( 'user_id' =&gt; $post-&gt;poster_id, 'component' =&gt; $bp-&gt;groups-&gt;id, 'type' =&gt; 'new_forum_post', 'item_id' =&gt; $bp-&gt;groups-&gt;current_group-&gt;id, 'secondary_item_id' =&gt; $post_id ) );
+
+                /* Update the entry in activity streams */
</ins><span class="cx">                 groups_record_activity( array(
</span><ins>+                        'id' =&gt; $id,
</ins><span class="cx">                         'action' =&gt; apply_filters( 'groups_activity_new_forum_post_action', $activity_action, $post_text, &amp;$topic, &amp;$forum_post ),
</span><span class="cx">                         'content' =&gt; apply_filters( 'groups_activity_new_forum_post_content', $activity_content, $post_text, &amp;$topic, &amp;$forum_post ),
</span><del>-                        'primary_link' =&gt; apply_filters( 'groups_activity_new_forum_post_primary_link', bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) ),
</del><ins>+                        'primary_link' =&gt; apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . &quot;#post-&quot; . $post_id ),
</ins><span class="cx">                         'type' =&gt; 'new_forum_post',
</span><span class="cx">                         'item_id' =&gt; (int)$bp-&gt;groups-&gt;current_group-&gt;id,
</span><span class="cx">                         'user_id' =&gt; (int)$post-&gt;poster_id,
</span><span class="cx">                         'secondary_item_id' =&gt; $post_id,
</span><del>-                        'recorded_time' =&gt; strtotime( $post-&gt;post_time )
</del><ins>+                        'recorded_time' =&gt; $post-&gt;post_time
</ins><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action( 'groups_update_group_forum_post', &amp;$post, &amp;$topic );
</span><span class="cx"> 
</span><del>-                return true;
</del><ins>+                return $post_id;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssdefaultcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/default.css (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/default.css        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-themes/bp-default/_inc/css/default.css        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -1529,12 +1529,14 @@
</span><span class="cx">                 padding: 5px 0;
</span><span class="cx">                 margin: 5px 0 25px 0;
</span><span class="cx">         }
</span><del>-                div.navigation .alignright {
</del><ins>+                .alignright {
</ins><span class="cx">                         float: right;
</span><ins>+                        margin-left: 15px;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                div.navigation .alignleft {
</del><ins>+                .alignleft {
</ins><span class="cx">                         float: left;
</span><ins>+                        margin-right: 15px;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">         div.post p { margin: 0 0 20px 0; }
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -670,6 +670,8 @@
</span><span class="cx">                         else
</span><span class="cx">                                 var el = j('li.filter select');
</span><span class="cx"> 
</span><ins>+                        alert(el.attr('id'));
+
</ins><span class="cx">                         var page_number = 1;
</span><span class="cx">                         var css_id = el.attr('id').split( '-' );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupssingleforumtopicphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/single/forum/topic.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/single/forum/topic.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-themes/bp-default/groups/single/forum/topic.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> 
</span><span class="cx">         &lt;form action=&quot;&lt;?php bp_forum_topic_action() ?&gt;&quot; method=&quot;post&quot; id=&quot;forum-topic-form&quot; class=&quot;standard-form&quot;&gt;
</span><span class="cx"> 
</span><del>-                &lt;div class=&quot;pagination&quot;&gt;
</del><ins>+                &lt;div class=&quot;pagination no-ajax&quot;&gt;
</ins><span class="cx"> 
</span><span class="cx">                         &lt;div id=&quot;post-count&quot; class=&quot;pag-count&quot;&gt;
</span><span class="cx">                                 &lt;?php bp_the_topic_pagination_count() ?&gt;
</span><span class="lines">@@ -36,46 +36,65 @@
</span><span class="cx">                                                 &lt;?php bp_the_topic_post_content() ?&gt;
</span><span class="cx">                                         &lt;/div&gt;
</span><span class="cx"> 
</span><del>-                                        &lt;?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) : ?&gt;
-                                                &lt;div class=&quot;admin-links&quot;&gt;&lt;?php bp_the_topic_post_admin_links() ?&gt;&lt;/div&gt;
-                                        &lt;?php endif; ?&gt;
</del><ins>+                                        &lt;div class=&quot;admin-links&quot;&gt;
+                                                &lt;?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) : ?&gt;
+                                                        &lt;?php bp_the_topic_post_admin_links() ?&gt;
+                                                &lt;?php endif; ?&gt;
+                                                &lt;a href=&quot;#post-&lt;?php bp_the_topic_post_id() ?&gt;&quot; title=&quot;&lt;?php _e( 'Permanent link to this post', 'buddypress' ) ?&gt;&quot;&gt;#&lt;/a&gt;
+                                        &lt;/div&gt;
</ins><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php endwhile; ?&gt;
</span><span class="cx">                 &lt;/ul&gt;
</span><span class="cx"> 
</span><ins>+                &lt;div class=&quot;pagination no-ajax&quot;&gt;
+
+                        &lt;div id=&quot;post-count&quot; class=&quot;pag-count&quot;&gt;
+                                &lt;?php bp_the_topic_pagination_count() ?&gt;
+                        &lt;/div&gt;
+
+                        &lt;div class=&quot;pagination-links&quot; id=&quot;topic-pag&quot;&gt;
+                                &lt;?php bp_the_topic_pagination() ?&gt;
+                        &lt;/div&gt;
+
+                &lt;/div&gt;
+
</ins><span class="cx">                 &lt;?php if ( ( is_user_logged_in() &amp;&amp; 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?&gt;
</span><span class="cx"> 
</span><del>-                        &lt;?php if ( bp_get_the_topic_is_topic_open() ) : ?&gt;
</del><ins>+                        &lt;?php if ( bp_get_the_topic_is_last_page() ) : ?&gt;
</ins><span class="cx"> 
</span><del>-                                &lt;div id=&quot;post-topic-reply&quot;&gt;
-                                        &lt;a name=&quot;post-reply&quot;&gt;&lt;/a&gt;
</del><ins>+                                &lt;?php if ( bp_get_the_topic_is_topic_open() ) : ?&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;?php if ( !bp_group_is_member() ) : ?&gt;
-                                                &lt;p&gt;&lt;?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?&gt;&lt;/p&gt;
-                                        &lt;?php endif; ?&gt;
</del><ins>+                                        &lt;div id=&quot;post-topic-reply&quot;&gt;
+                                                &lt;p id=&quot;post-reply&quot;&gt;&lt;/p&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;?php do_action( 'groups_forum_new_reply_before' ) ?&gt;
</del><ins>+                                                &lt;?php if ( !bp_group_is_member() ) : ?&gt;
+                                                        &lt;p&gt;&lt;?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?&gt;&lt;/p&gt;
+                                                &lt;?php endif; ?&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;p&gt;&lt;strong&gt;&lt;?php _e( 'Add a reply:', 'buddypress' ) ?&gt;&lt;/strong&gt;&lt;/p&gt;
</del><ins>+                                                &lt;?php do_action( 'groups_forum_new_reply_before' ) ?&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;textarea name=&quot;reply_text&quot; id=&quot;reply_text&quot;&gt;&lt;/textarea&gt;
</del><ins>+                                                &lt;h4&gt;&lt;?php _e( 'Add a reply:', 'buddypress' ) ?&gt;&lt;/h4&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;div class=&quot;submit&quot;&gt;
-                                                &lt;input type=&quot;submit&quot; name=&quot;submit_reply&quot; id=&quot;submit&quot; value=&quot;&lt;?php _e( 'Post Reply', 'buddypress' ) ?&gt;&quot; /&gt;
</del><ins>+                                                &lt;textarea name=&quot;reply_text&quot; id=&quot;reply_text&quot;&gt;&lt;/textarea&gt;
+
+                                                &lt;div class=&quot;submit&quot;&gt;
+                                                        &lt;input type=&quot;submit&quot; name=&quot;submit_reply&quot; id=&quot;submit&quot; value=&quot;&lt;?php _e( 'Post Reply', 'buddypress' ) ?&gt;&quot; /&gt;
+                                                &lt;/div&gt;
+
+                                                &lt;?php do_action( 'groups_forum_new_reply_after' ) ?&gt;
+
+                                                &lt;?php wp_nonce_field( 'bp_forums_new_reply' ) ?&gt;
</ins><span class="cx">                                         &lt;/div&gt;
</span><span class="cx"> 
</span><del>-                                        &lt;?php do_action( 'groups_forum_new_reply_after' ) ?&gt;
</del><ins>+                                &lt;?php else : ?&gt;
</ins><span class="cx"> 
</span><del>-                                        &lt;?php wp_nonce_field( 'bp_forums_new_reply' ) ?&gt;
-                                &lt;/div&gt;
</del><ins>+                                        &lt;div id=&quot;message&quot; class=&quot;info&quot;&gt;
+                                                &lt;p&gt;&lt;?php _e( 'This topic is closed, replies are no longer accepted.', 'buddypress' ) ?&gt;&lt;/p&gt;
+                                        &lt;/div&gt;
</ins><span class="cx"> 
</span><del>-                        &lt;?php else : ?&gt;
</del><ins>+                                &lt;?php endif; ?&gt;
</ins><span class="cx"> 
</span><del>-                                &lt;div id=&quot;message&quot; class=&quot;info&quot;&gt;
-                                        &lt;p&gt;&lt;?php _e( 'This topic is closed, replies are no longer accepted.', 'buddypress' ) ?&gt;&lt;/p&gt;
-                                &lt;/div&gt;
-
</del><span class="cx">                         &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;?php endif; ?&gt;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupssingleforumphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/single/forum.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/single/forum.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-themes/bp-default/groups/single/forum.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -26,8 +26,8 @@
</span><span class="cx">                                         &lt;p&gt;&lt;?php _e( 'You will auto join this group when you start a new topic.', 'buddypress' ) ?&gt;&lt;/p&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;a name=&quot;post-new&quot;&gt;&lt;/a&gt;
-                                &lt;h3&gt;&lt;?php _e( 'Post a New Topic:', 'buddypress' ) ?&gt;&lt;/h3&gt;
</del><ins>+                                &lt;p id=&quot;post-new&quot;&gt;&lt;/p&gt;
+                                &lt;h4&gt;&lt;?php _e( 'Post a New Topic:', 'buddypress' ) ?&gt;&lt;/h4&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;label&gt;&lt;?php _e( 'Title:', 'buddypress' ) ?&gt;&lt;/label&gt;
</span><span class="cx">                                 &lt;input type=&quot;text&quot; name=&quot;topic_title&quot; id=&quot;topic_title&quot; value=&quot;&quot; /&gt;
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (2459 => 2460)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2010-01-26 15:45:05 UTC (rev 2459)
+++ trunk/bp-xprofile.php        2010-01-26 17:49:48 UTC (rev 2460)
</span><span class="lines">@@ -489,13 +489,14 @@
</span><span class="cx">                 'type' =&gt; false,
</span><span class="cx">                 'item_id' =&gt; false,
</span><span class="cx">                 'secondary_item_id' =&gt; false,
</span><ins>+                'recorded_time' =&gt; gmdate( &quot;Y-m-d H:i:s&quot; ),
</ins><span class="cx">                 'hide_sitewide' =&gt; false
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         $r = wp_parse_args( $args, $defaults );
</span><span class="cx">         extract( $r, EXTR_SKIP );
</span><span class="cx"> 
</span><del>-        return bp_activity_add( array( 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'hide_sitewide' =&gt; $hide_sitewide ) );
</del><ins>+        return bp_activity_add( array( 'user_id' =&gt; $user_id, 'action' =&gt; $action, 'content' =&gt; $content, 'primary_link' =&gt; $primary_link, 'component' =&gt; $component, 'type' =&gt; $type, 'item_id' =&gt; $item_id, 'secondary_item_id' =&gt; $secondary_item_id, 'recorded_time' =&gt; $recorded_time, 'hide_sitewide' =&gt; $hide_sitewide ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre>
</div>
</div>

</body>
</html>