<!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] [2692] trunk:
Fixed support for specific actions such as new update,
new reply and favoriting activities when JS is turned off.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2692</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-12 01:17:56 +0000 (Fri, 12 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixed support for specific actions such as new update, new reply and favoriting activities when JS is turned off.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<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>
<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="#trunkbpthemesbpdefaultactivityentryphp">trunk/bp-themes/bp-default/activity/entry.php</a></li>
<li><a href="#trunkbpthemesbpdefaultactivitypostformphp">trunk/bp-themes/bp-default/activity/post-form.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 (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-activity/bp-activity-classes.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -247,7 +247,7 @@
</span><span class="cx">                         'user_id' => false,
</span><span class="cx">                         'item_id' => false,
</span><span class="cx">                         'secondary_item_id' => false,
</span><del>-                        'recorded_time' => false,
</del><ins>+                        'date_recorded' => false,
</ins><span class="cx">                         'hide_sitewide' => false
</span><span class="cx">                 );
</span><span class="cx">
</span><span class="lines">@@ -280,11 +280,11 @@
</span><span class="cx">                 if ( !empty( $secondary_item_id ) )
</span><span class="cx">                         $where_args[] = $wpdb->prepare( "secondary_item_id = %s", $secondary_item_id );
</span><span class="cx">
</span><del>-                if ( !empty( $recorded_time ) )
-                        $where_args[] = $wpdb->prepare( "recorded_time = %s", $recorded_time );
</del><ins>+                if ( !empty( $date_recorded ) )
+                        $where_args[] = $wpdb->prepare( "date_recorded = %s", $date_recorded );
</ins><span class="cx">
</span><span class="cx">                 if ( !empty( $hide_sitewide ) )
</span><del>-                        $where_args[] = $wpdb->prepare( "recorded_time = %d", $hide_sitewide );
</del><ins>+                        $where_args[] = $wpdb->prepare( "hide_sitewide = %d", $hide_sitewide );
</ins><span class="cx">
</span><span class="cx">                 if ( !empty( $where_args ) )
</span><span class="cx">                         $where_sql = 'WHERE ' . join( ' AND ', $where_args );
</span></span></pre></div>
<a id="trunkbpactivitybpactivitytemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-templatetags.php (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-activity/bp-activity-templatetags.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -568,9 +568,9 @@
</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 class="cx">
</span><del>-                                /* Reply link */
</del><ins>+                                /* Reply link - the span is so that threaded reply links can be hidden when JS is off. */
</ins><span class="cx">                                 if ( is_user_logged_in() )
</span><del>-                                        $content .= ' &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a>';
</del><ins>+                                        $content .= '<span class="acomment-replylink"> &middot; <a href="#acomment-' . $comment->id . '" class="acomment-reply" id="acomment-reply-' . $activities_template->activity->id . '">' . __( 'Reply', 'buddypress' ) . '</a></span>';
</ins><span class="cx">
</span><span class="cx">                                 /* Delete link */
</span><span class="cx">                                 if ( is_site_admin() || $bp->loggedin_user->id == $comment->user_id )
</span><span class="lines">@@ -614,6 +614,32 @@
</span><span class="cx">                         return $count;
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+function bp_activity_comment_link() {
+        echo bp_get_activity_comment_link();
+}
+        function bp_get_activity_comment_link() {
+                global $activities_template;
+                return apply_filters( 'bp_get_activity_comment_link', '?ac=' . $activities_template->activity->id . '/#ac-form-' . $activities_template->activity->id );
+        }
+
+function bp_activity_comment_form_nojs_display() {
+        echo bp_get_activity_comment_form_nojs_display();
+}
+        function bp_get_activity_comment_form_nojs_display() {
+                global $activities_template;
+                if ( $_GET['ac'] == $activities_template->activity->id . '/' )
+                        return 'style="display: block"';
+
+                return false;
+        }
+
+function bp_activity_comment_form_action() {
+        echo bp_get_activity_comment_form_action();
+}
+        function bp_get_activity_comment_form_action() {
+                return apply_filters( 'bp_get_activity_comment_form_action', site_url( BP_ACTIVITY_SLUG . '/reply/' ) );
+        }
+
</ins><span class="cx"> function bp_activity_permalink_id() {
</span><span class="cx">         echo bp_get_activity_permalink_id();
</span><span class="cx"> }
</span><span class="lines">@@ -634,6 +660,22 @@
</span><span class="cx">                  return apply_filters( 'bp_get_activity_thread_permalink', $link );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+function bp_activity_favorite_link() {
+        echo bp_get_activity_favorite_link();
+}
+        function bp_get_activity_favorite_link() {
+                global $activities_template;
+                return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) );
+        }
+
+function bp_activity_unfavorite_link() {
+        echo bp_get_activity_unfavorite_link();
+}
+        function bp_get_activity_unfavorite_link() {
+                global $activities_template;
+                return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) );
+        }
+
</ins><span class="cx"> function bp_activity_css_class() {
</span><span class="cx">         echo bp_get_activity_css_class();
</span><span class="cx"> }
</span><span class="lines">@@ -791,6 +833,12 @@
</span><span class="cx">                 return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+function bp_activity_post_form_action() {
+        echo bp_get_activity_post_form_action();
+}
+        function bp_get_activity_post_form_action() {
+                return apply_filters( 'bp_get_activity_post_form_action', site_url( BP_ACTIVITY_SLUG . '/post/' ) );
+        }
</ins><span class="cx">
</span><span class="cx"> /* RSS Feed Template Tags ***************************/
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-activity.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -360,6 +360,111 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp', 'bp_activity_action_delete_activity', 3 );
</span><span class="cx">
</span><ins>+function bp_activity_action_post_update() {
+        global $bp;
+
+        if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'post' )
+                return false;
+
+        /* Check the nonce */
+        check_admin_referer( 'post_update', '_wpnonce_post_update' );
+
+        $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
+        $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
+        $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
+
+        if ( empty( $content ) ) {
+                bp_core_add_message( __( 'Please enter some content to post.', 'buddypress' ), 'error' );
+                bp_core_redirect( wp_get_referer() );
+        }
+
+        if ( !(int)$item_id ) {
+                $activity_id = bp_activity_post_update( array( 'content' => $content ) );
+
+        } else if ( 'groups' == $object && function_exists( 'groups_post_update' ) ) {
+                if ( (int)$item_id ) {
+                        $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
+                }
+        } else
+                $activity_id = apply_filters( 'bp_activity_custom_update', $object, $item_id, $content );
+
+        if ( !empty( $activity_id ) )
+                bp_core_add_message( __( 'Update Posted!', 'buddypress' ) );
+        else
+                bp_core_add_message( __( 'There was an error when posting your update, please try again.', 'buddypress' ), 'error' );
+
+        bp_core_redirect( wp_get_referer() );
+}
+add_action( 'wp', 'bp_activity_action_post_update', 3 );
+
+function bp_activity_action_post_comment() {
+        global $bp;
+
+        if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'reply' )
+                return false;
+
+        /* Check the nonce */
+        check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
+
+        $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
+        $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
+
+        if ( empty( $content ) ) {
+                bp_core_add_message( __( 'Please do not leave the comment area blank.', 'buddypress' ), 'error' );
+                bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
+        }
+
+        $comment_id = bp_activity_new_comment( array(
+                'content' => $content,
+                'activity_id' => $activity_id,
+                'parent_id' => $parent_id
+        ));
+
+        if ( !empty( $comment_id ) )
+                bp_core_add_message( __( 'Reply Posted!', 'buddypress' ) );
+        else
+                bp_core_add_message( __( 'There was an error posting that reply, please try again.', 'buddypress' ), 'error' );
+
+        bp_core_redirect( wp_get_referer() . '#ac-form-' . $activity_id );
+}
+add_action( 'wp', 'bp_activity_action_post_comment', 3 );
+
+function bp_activity_action_mark_favorite() {
+        global $bp;
+
+        if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'favorite' )
+                return false;
+
+        /* Check the nonce */
+        check_admin_referer( 'mark_favorite' );
+
+        if ( bp_activity_add_user_favorite( $bp->action_variables[0] ) )
+                bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
+        else
+                bp_core_add_message( __( 'There was an error marking that activity as a favorite, please try again.', 'buddypress' ), 'error' );
+
+        bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
+}
+add_action( 'wp', 'bp_activity_action_mark_favorite', 3 );
+
+function bp_activity_action_remove_favorite() {
+        global $bp;
+
+        if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unfavorite' )
+                return false;
+
+        /* Check the nonce */
+        check_admin_referer( 'unmark_favorite' );
+
+        if ( bp_activity_remove_user_favorite( $bp->action_variables[0] ) )
+                bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
+        else
+                bp_core_add_message( __( 'There was an error removing that activity as a favorite, please try again.', 'buddypress' ), 'error' );
+
+        bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
+}
+add_action( 'wp', 'bp_activity_action_remove_favorite', 3 );
+
</ins><span class="cx"> function bp_activity_action_sitewide_feed() {
</span><span class="cx">         global $bp, $wp_query;
</span><span class="cx">
</span><span class="lines">@@ -894,10 +999,10 @@
</span><span class="cx">
</span><span class="cx">         /* Update the user's personal favorites */
</span><span class="cx">         $my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) );
</span><del>-        $my_favs[] = $_POST['id'];
</del><ins>+        $my_favs[] = $activity_id;
</ins><span class="cx">
</span><span class="cx">         /* Update the total number of users who have favorited this activity */
</span><del>-        $fav_count = bp_activity_get_meta( $_POST['id'], 'favorite_count' );
</del><ins>+        $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
</ins><span class="cx">
</span><span class="cx">         if ( !empty( $fav_count ) )
</span><span class="cx">                 $fav_count = (int)$fav_count + 1;
</span><span class="lines">@@ -905,7 +1010,7 @@
</span><span class="cx">                 $fav_count = 1;
</span><span class="cx">
</span><span class="cx">         update_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
</span><del>-        bp_activity_update_meta( $_POST['id'], 'favorite_count', $fav_count );
</del><ins>+        bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
</ins><span class="cx">
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -919,15 +1024,15 @@
</span><span class="cx">         /* Remove the fav from the user's favs */
</span><span class="cx">         $my_favs = maybe_unserialize( get_usermeta( $user_id, 'bp_favorite_activities' ) );
</span><span class="cx">         $my_favs = array_flip( (array) $my_favs );
</span><del>-        unset( $my_favs[$_POST['id']] );
</del><ins>+        unset( $my_favs[$activity_id] );
</ins><span class="cx">         $my_favs = array_unique( array_flip( $my_favs ) );
</span><span class="cx">
</span><span class="cx">         /* Update the total number of users who have favorited this activity */
</span><del>-        $fav_count = bp_activity_get_meta( $_POST['id'], 'favorite_count' );
</del><ins>+        $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
</ins><span class="cx">
</span><span class="cx">         if ( !empty( $fav_count ) ) {
</span><span class="cx">                 $fav_count = (int)$fav_count - 1;
</span><del>-                bp_activity_update_meta( $_POST['id'], 'favorite_count', $fav_count );
</del><ins>+                bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         update_usermeta( $user_id, 'bp_favorite_activities', $my_favs );
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -10,10 +10,12 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> /***
</span><del>- * Each object loop (activity/members/groups/blogs/forums) contains parameters to
</del><ins>+ * This function looks scarier than it actually is. :)
+ * Each object loop (activity/members/groups/blogs/forums) contains default parameters to
</ins><span class="cx"> * show specific information based on the page we are currently looking at.
</span><span class="cx"> * The following function will take into account any cookies set in the JS and allow us
</span><span class="cx"> * to override the parameters sent. That way we can change the results returned without reloading the page.
</span><ins>+ * By using cookies we can also make sure that user settings are retained across page loads.
</ins><span class="cx"> */
</span><span class="cx"> function bp_dtheme_ajax_querystring( $object = false ) {
</span><span class="cx">         global $bp;
</span><span class="lines">@@ -60,6 +62,7 @@
</span><span class="cx">         return apply_filters( 'bp_dtheme_ajax_querystring', $query_string, $object, $_BP_COOKIE['bp-' . $object . '-filter'], $_BP_COOKIE['bp-' . $object . '-scope'], $_BP_COOKIE['bp-' . $object . '-page'], $_BP_COOKIE['bp-' . $object . '-search-terms'], $_BP_COOKIE['bp-' . $object . '-extras'] );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* This function will simply load the template loop for the current object. On an AJAX request */
</ins><span class="cx"> function bp_dtheme_object_template_loader() {
</span><span class="cx">         $object = esc_attr( $_POST['object'] );
</span><span class="cx">         locate_template( array( "$object/$object-loop.php" ), true );
</span><span class="lines">@@ -69,6 +72,7 @@
</span><span class="cx"> add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_template_loader' );
</span><span class="cx"> add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_template_loader' );
</span><span class="cx">
</span><ins>+/* This function will load the activity loop template when activity is requested via AJAX */
</ins><span class="cx"> function bp_dtheme_activity_template_loader() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -103,6 +107,7 @@
</span><span class="cx"> add_action( 'wp_ajax_activity_widget_filter', 'bp_dtheme_activity_template_loader' );
</span><span class="cx"> add_action( 'wp_ajax_activity_get_older_updates', 'bp_dtheme_activity_template_loader' );
</span><span class="cx">
</span><ins>+/* AJAX update posting */
</ins><span class="cx"> function bp_dtheme_post_update() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -119,20 +124,13 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( empty( $_POST['object'] ) ) {
-                $activity_id = bp_activity_post_update( array(
-                        'content' => $_POST['content']
-                ));
</del><ins>+        if ( empty( $_POST['object'] ) && function_exists( 'bp_activity_post_update' ) ) {
+                $activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) );
</ins><span class="cx">         } elseif ( $_POST['object'] == 'groups' ) {
</span><del>-                if ( !empty( $_POST['item_id'] ) ) {
-                $activity_id = groups_post_update( array(
-                        'content' => $_POST['content'],
-                                'group_id' => $_POST['item_id']
-                ));
-                }
-        } else {
</del><ins>+                if ( !empty( $_POST['item_id'] ) && function_exists( 'groups_post_update' ) )
+                        $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) );
+        } else
</ins><span class="cx">                 $activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] );
</span><del>-        }
</del><span class="cx">
</span><span class="cx">         if ( !$activity_id ) {
</span><span class="cx">                 echo '-1<div id="message" class="error"><p>' . __( 'There was a problem posting your update, please try again.', 'buddypress' ) . '</p></div>';
</span><span class="lines">@@ -147,6 +145,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );
</span><span class="cx">
</span><ins>+/* AJAX activity comment posting */
</ins><span class="cx"> function bp_dtheme_new_activity_comment() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -201,6 +200,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' );
</span><span class="cx">
</span><ins>+/* AJAX delete an activity */
</ins><span class="cx"> function bp_dtheme_delete_activity() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -227,6 +227,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' );
</span><span class="cx">
</span><ins>+/* AJAX delete an activity comment */
</ins><span class="cx"> function bp_dtheme_delete_activity_comment() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -253,6 +254,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' );
</span><span class="cx">
</span><ins>+/* AJAX mark an activity as a favorite */
</ins><span class="cx"> function bp_dtheme_mark_activity_favorite() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -261,6 +263,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' );
</span><span class="cx">
</span><ins>+/* AJAX mark an activity as not a favorite */
</ins><span class="cx"> function bp_dtheme_unmark_activity_favorite() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -269,6 +272,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' );
</span><span class="cx">
</span><ins>+/* AJAX invite a friend to a group functionality */
</ins><span class="cx"> function bp_dtheme_ajax_invite_user() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -312,6 +316,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_groups_invite_user', 'bp_dtheme_ajax_invite_user' );
</span><span class="cx">
</span><ins>+/* AJAX add/remove a user as a friend when clicking the button */
</ins><span class="cx"> function bp_dtheme_ajax_addremove_friend() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -342,6 +347,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_addremove_friend', 'bp_dtheme_ajax_addremove_friend' );
</span><span class="cx">
</span><ins>+/* AJAX accept a user as a friend when clicking the "accept" button */
</ins><span class="cx"> function bp_dtheme_ajax_accept_friendship() {
</span><span class="cx">         check_admin_referer( 'friends_accept_friendship' );
</span><span class="cx">
</span><span class="lines">@@ -352,6 +358,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_accept_friendship', 'bp_dtheme_ajax_accept_friendship' );
</span><span class="cx">
</span><ins>+/* AJAX reject a user as a friend when clicking the "reject" button */
</ins><span class="cx"> function bp_dtheme_ajax_reject_friendship() {
</span><span class="cx">         check_admin_referer( 'friends_reject_friendship' );
</span><span class="cx">
</span><span class="lines">@@ -362,6 +369,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_reject_friendship', 'bp_dtheme_ajax_reject_friendship' );
</span><span class="cx">
</span><ins>+/* AJAX join or leave a group when clicking the "join/leave" button */
</ins><span class="cx"> function bp_dtheme_ajax_joinleave_group() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -414,6 +422,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_joinleave_group', 'bp_dtheme_ajax_joinleave_group' );
</span><span class="cx">
</span><ins>+/* AJAX close and keep closed site wide notices from an admin in the sidebar */
</ins><span class="cx"> function bp_dtheme_ajax_close_notice() {
</span><span class="cx">         global $userdata;
</span><span class="cx">
</span><span class="lines">@@ -429,6 +438,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' );
</span><span class="cx">
</span><ins>+/* AJAX send a private message reply to a thread */
</ins><span class="cx"> function bp_dtheme_ajax_messages_send_reply() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -464,6 +474,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_send_reply', 'bp_dtheme_ajax_messages_send_reply' );
</span><span class="cx">
</span><ins>+/* AJAX mark a private message as unread in your inbox */
</ins><span class="cx"> function bp_dtheme_ajax_message_markunread() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -479,6 +490,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_markunread', 'bp_dtheme_ajax_message_markunread' );
</span><span class="cx">
</span><ins>+/* AJAX mark a private message as read in your inbox */
</ins><span class="cx"> function bp_dtheme_ajax_message_markread() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -494,6 +506,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_markread', 'bp_dtheme_ajax_message_markread' );
</span><span class="cx">
</span><ins>+/* AJAX delete a private message or array of messages in your inbox */
</ins><span class="cx"> function bp_dtheme_ajax_messages_delete() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -510,6 +523,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_delete', 'bp_dtheme_ajax_messages_delete' );
</span><span class="cx">
</span><ins>+/* AJAX autocomplete your friends names on the compose screen */
</ins><span class="cx"> function bp_dtheme_ajax_messages_autocomplete_results() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_inccssdefaultcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/default.css (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/default.css        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-themes/bp-default/_inc/css/default.css        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -1295,6 +1295,8 @@
</span><span class="cx">                         padding: 15px 0 15px 0;
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+                div.activity-comments span.acomment-replylink { display: none; }
+
</ins><span class="cx">                 div.activity-comments ul li p:last-child {
</span><span class="cx">                         margin-bottom: 0;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/global.js (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/global.js        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-themes/bp-default/_inc/global.js        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -7,6 +7,14 @@
</span><span class="cx"> j(document).ready( function() {
</span><span class="cx">         /**** Page Load Actions *******************************************************/
</span><span class="cx">
</span><ins>+        /* Hide Forums Post Form */
+        if ( j('div.forums').length )
+                j('div#new-topic-post').hide();
+
+        /* Show threaded reply links */
+        if ( j('span.acomment-replylink').length )
+                j('span.acomment-replylink').show();
+
</ins><span class="cx">         /* Activity filter and scope set */
</span><span class="cx">         bp_init_activity();
</span><span class="cx">
</span><span class="lines">@@ -14,10 +22,6 @@
</span><span class="cx">         var objects = [ 'members', 'groups', 'blogs', 'forums' ];
</span><span class="cx">         bp_init_objects( objects );
</span><span class="cx">
</span><del>-        /* Hide Forums Post Form */
-        if ( j('div.forums').length )
-                j('div#new-topic-post').hide();
-
</del><span class="cx">         /* @mention Compose Scrolling */
</span><span class="cx">         if ( j.query.get('r') ) {
</span><span class="cx">                 if ( j('textarea#whats-new').length ) {
</span><span class="lines">@@ -307,7 +311,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 /* Activity comment posting */
</span><del>-                if ( target.attr('name') == 'ac-form-submit' ) {
</del><ins>+                if ( target.attr('name') == 'ac_form_submit' ) {
</ins><span class="cx">                         var form = target.parent().parent();
</span><span class="cx">                         var form_parent = form.parent();
</span><span class="cx">                         var form_id = form.attr('id').split('-');
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivityentryphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/entry.php (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/entry.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-themes/bp-default/activity/entry.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -25,14 +25,14 @@
</span><span class="cx">
</span><span class="cx">                 <div class="activity-meta">
</span><span class="cx">                         <?php if ( is_user_logged_in() && bp_activity_can_comment() ) : ?>
</span><del>-                                <a href="#acomment-<?php bp_activity_id() ?>" class="acomment-reply" id="acomment-comment-<?php bp_activity_id() ?>"><?php _e( 'Reply', 'buddypress' ) ?> (<span><?php bp_activity_comment_count() ?></span>)</a>
</del><ins>+                                <a href="<?php bp_activity_comment_link() ?>" class="acomment-reply" id="acomment-comment-<?php bp_activity_id() ?>"><?php _e( 'Reply', 'buddypress' ) ?> (<span><?php bp_activity_comment_count() ?></span>)</a>
</ins><span class="cx">                         <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                         <?php if ( is_user_logged_in() ) : ?>
</span><span class="cx">                                 <?php if ( !bp_get_activity_is_favorite() ) : ?>
</span><del>-                                        <a href="" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
</del><ins>+                                        <a href="<?php bp_activity_favorite_link() ?>" class="fav" title="<?php _e( 'Mark as Favorite', 'buddypress' ) ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
</ins><span class="cx">                                 <?php else : ?>
</span><del>-                                        <a href="" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
</del><ins>+                                        <a href="<?php bp_activity_unfavorite_link() ?>" class="unfav" title="<?php _e( 'Remove Favorite', 'buddypress' ) ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
</ins><span class="cx">                                 <?php endif; ?>
</span><span class="cx">                         <?php endif;?>
</span><span class="cx">
</span><span class="lines">@@ -54,13 +54,14 @@
</span><span class="cx">                         <?php bp_activity_comments() ?>
</span><span class="cx">
</span><span class="cx">                         <?php if ( is_user_logged_in() ) : ?>
</span><del>-                        <form action="" method="post" name="activity-comment-form" id="ac-form-<?php bp_activity_id() ?>" class="ac-form">
</del><ins>+                        <form action="<?php bp_activity_comment_form_action() ?>" method="post" id="ac-form-<?php bp_activity_id() ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display() ?>>
</ins><span class="cx">                                 <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=25&height=25' ) ?></div>
</span><span class="cx">                                 <div class="ac-reply-content">
</span><span class="cx">                                         <div class="ac-textarea">
</span><del>-                                                <textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac-input-<?php bp_activity_id() ?>"></textarea>
</del><ins>+                                                <textarea id="ac-input-<?php bp_activity_id() ?>" class="ac-input" name="ac_input_<?php bp_activity_id() ?>"></textarea>
</ins><span class="cx">                                         </div>
</span><del>-                                        <input type="submit" name="ac-form-submit" value="<?php _e( 'Post', 'buddypress' ) ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ) ?>
</del><ins>+                                        <input type="submit" name="ac_form_submit" value="<?php _e( 'Post', 'buddypress' ) ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ) ?>
+                                        <input type="hidden" name="comment_form_id" value="<?php bp_activity_id() ?>" />
</ins><span class="cx">                                 </div>
</span><span class="cx">                                 <?php wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' ) ?>
</span><span class="cx">                         </form>
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivitypostformphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/post-form.php (2691 => 2692)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/post-form.php        2010-02-11 21:36:52 UTC (rev 2691)
+++ trunk/bp-themes/bp-default/activity/post-form.php        2010-02-12 01:17:56 UTC (rev 2692)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-<form action="" method="post" id="whats-new-form" name="whats-new-form">
</del><ins>+<form action="<?php bp_activity_post_form_action() ?>" method="post" id="whats-new-form" name="whats-new-form">
</ins><span class="cx">
</span><span class="cx">         <?php do_action( 'bp_before_activity_post_form' ) ?>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>