<!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" />
<title>[BuddyPress][5339] trunk: See #3660.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/5339">5339</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-11-20 23:39:56 +0000 (Sun, 20 Nov 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>See <a href="http://buddypress.trac.wordpress.org/ticket/3660">#3660</a>. Activity admin iteration.
* "Reply" button now works.
* Fixed incorrect HTML markup.
* Improve error handling when an update on an activity fails.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityadminphp">trunk/bp-activity/bp-activity-admin.php</a></li>
<li><a href="#trunkreadmetxt">trunk/readme.txt</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/bp-activity/admin/</li>
<li>trunk/bp-activity/admin/css/</li>
<li><a href="#trunkbpactivityadmincssadmincss">trunk/bp-activity/admin/css/admin.css</a></li>
<li><a href="#trunkbpactivityadmincssadmindevcss">trunk/bp-activity/admin/css/admin.dev.css</a></li>
<li>trunk/bp-activity/admin/js/</li>
<li><a href="#trunkbpactivityadminjsadmindevjs">trunk/bp-activity/admin/js/admin.dev.js</a></li>
<li><a href="#trunkbpactivityadminjsadminjs">trunk/bp-activity/admin/js/admin.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityadmincssadmincss"></a>
<div class="addfile"><h4>Added: trunk/bp-activity/admin/css/admin.css (0 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.css         (rev 0)
+++ trunk/bp-activity/admin/css/admin.css        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+#wp-bp-activities-wrap{padding:5px 0;}#bp-activities{height:120px;}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0;}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center;}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top;}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivityadmincssadmindevcss"></a>
<div class="addfile"><h4>Added: trunk/bp-activity/admin/css/admin.dev.css (0 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.dev.css         (rev 0)
+++ trunk/bp-activity/admin/css/admin.dev.css        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+#wp-bp-activities-wrap {
+        padding: 5px 0;
+}
+
+#bp-activities {
+        height: 120px;
+}
+
+#bp-replyhead {
+        font-size: 1em;
+        line-height: 1.4em;
+        margin: 0;
+}
+
+#bp-replysubmit {
+        margin: 0;
+        padding: 0 0 3px;
+        text-align: center;
+}
+
+#bp-replysubmit .error {
+        color: red;
+        line-height: 21px;
+        text-align: center;
+        vertical-align: center;
+}
+
+#bp-replysubmit img.waiting {
+        float: right;
+        padding: 4px 10px 0;
+        vertical-align: top;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivityadminjsadmindevjs"></a>
<div class="addfile"><h4>Added: trunk/bp-activity/admin/js/admin.dev.js (0 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/js/admin.dev.js         (rev 0)
+++ trunk/bp-activity/admin/js/admin.dev.js        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+(function( $ ) {
+
+/**
+ * Activity reply object for the admin screen
+ *
+ * @since 1.6
+ */
+activityReply = {
+
+        /**
+         * Attach event handler functions to the relevant elements.
+         *
+         * @since 1.6
+         */
+        init : function() {
+                $(document).on( 'click', '.row-actions a.reply', activityReply.open );
+                $(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
+                $(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
+
+                // Close textarea on escape
+                $(document).on( 'keyup', '#bp-activities:visible', function( e ) {
+                        if ( 27 == e.which ) {
+                                activityReply.close();
+                        }
+                });
+        },
+
+        /**
+         * Reveals the entire row when "reply" is pressed.
+         *
+         * @since 1.6
+         */
+        open : function( e ) {
+                // Hide the container row, and move it to the new location
+                var box = $( '#bp-activities-container' ).hide();
+                $( this ).parents( 'tr' ).after( box );
+
+                // Fade the whole row in, and set focus on the text area.
+                box.fadeIn( '300' );
+                $( '#bp-activities' ).focus();
+
+                return false;
+        },
+
+        /**
+         * Hide and reset the entire row when "cancel", or escape, are pressed.
+         *
+         * @since 1.6
+         */
+        close : function( e ) {
+                // Hide the container row
+                $('#bp-activities-container').fadeOut( '200', function () {
+
+                        // Empty and unfocus the text area
+                        $( '#bp-activities' ).val( '' ).blur();
+
+                        // Remove any error message and disable the spinner
+                        $( '#bp-replysubmit .error' ).html( '' ).hide();
+                        $( '#bp-replysubmit .waiting' ).hide();
+                });
+
+                return false;
+        },
+
+        /**
+         * Submits "form" via AJAX back to WordPress.
+         *
+         * @since 1.6
+         */
+        send : function( e ) {
+                // Hide any existing error message, and show the loading spinner
+                $( '#bp-replysubmit .error' ).hide();
+                $( '#bp-replysubmit .waiting' ).show();
+
+                // Grab the nonce
+                var reply = {};
+                reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
+
+                // Get the rest of the data
+                reply.action = 'bp-activity-admin-reply';
+                reply.content = $( '#bp-activities' ).val();
+                reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
+                reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
+
+                // Make the AJAX call
+                $.ajax({
+                        data : reply,
+                        type : 'POST',
+                        url : ajaxurl,
+
+                        // Callbacks
+                        error : function( r ) { activityReply.error( r ); },
+                        success : function( r ) { activityReply.show( r ); }
+                });
+
+                return false;
+        },
+
+        /**
+         * send() error message handler
+         *
+         * @since 1.6
+         */
+        error : function( r ) {
+                var er = r.statusText;
+                $('#bp-replysubmit .waiting').hide();
+
+                if ( r.responseText ) {
+                        er = r.responseText.replace( /<.[^<>]*?>/g, '' );
+                }
+
+                if ( er ) {
+                        $('#bp-replysubmit .error').html( er ).show();
+                }
+        },
+
+        /**
+         * send() success handler
+         *
+         * @since 1.6
+         */
+        show : function ( xml ) {
+                var bg, id, response;
+
+                // Handle any errors in the response
+                if ( typeof( xml ) == 'string' ) {
+                        activityReply.error( { 'responseText': xml } );
+                        return false;
+                }
+
+                response = wpAjax.parseAjaxResponse( xml );
+                if ( response.errors ) {
+                        activityReply.error( { 'responseText': wpAjax.broken } );
+                        return false;
+                }
+                response = response.responses[0];
+
+                // Close and reset the reply row, and add the new Activity item into the list.
+                $('#bp-activities-container').fadeOut( '200', function () {
+
+                        // Empty and unfocus the text area
+                        $( '#bp-activities' ).val( '' ).blur();
+
+                        // Remove any error message and disable the spinner
+                        $( '#bp-replysubmit .error' ).html( '' ).hide();
+                        $( '#bp-replysubmit .waiting' ).hide();
+
+                        // Insert new activity item
+                        $( '#bp-activities-container' ).before( response.data );
+
+                        // Get background colour and animate the flash
+                        id = $( '#activity-' + response.id );
+                        bg = id.closest( '.widefat' ).css( 'backgroundColor' );
+                        id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
+                });
+        }
+};
+
+// Create the Activity reply object after domready event
+$(document).ready( activityReply.init );
+})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivityadminjsadminjs"></a>
<div class="addfile"><h4>Added: trunk/bp-activity/admin/js/admin.js (0 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/js/admin.js         (rev 0)
+++ trunk/bp-activity/admin/js/admin.js        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+(function(a){activityReply={init:function(){a(document).on("click",".row-actions a.reply",activityReply.open);a(document).on("click","#bp-activities-container a.cancel",activityReply.close);a(document).on("click","#bp-activities-container a.save",activityReply.send);a(document).on("keyup","#bp-activities:visible",function(b){if(27==b.which){activityReply.close()}})},open:function(c){var b=a("#bp-activities-container").hide();a(this).parents("tr").after(b);b.fadeIn("300");a("#bp-activities").focus();return false},close:function(b){a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur();a("#bp-replysubmit .error").html("").hide();a("#bp-replysubmit .waiting").hide()});return false},send:function(c){a("#bp-replysubmit .error").hide();a(
"#bp-replysubmit .waiting").show();var b={};b["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val();b.action="bp-activity-admin-reply";b.content=a("#bp-activities").val();b.parent_id=a("#bp-activities-container").prev().data("parent_id");b.root_id=a("#bp-activities-container").prev().data("root_id");a.ajax({data:b,type:"POST",url:ajaxurl,error:function(d){activityReply.error(d)},success:function(d){activityReply.show(d)}});return false},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#bp-replysubmit .error").html(c).show()}},show:function(c){var d,e,b;if(typeof(c)=="string"){activityReply.error({responseText:c});return false}b=wpAjax.parseAjaxResponse(c);if(b.e
rrors){activityReply.error({responseText:wpAjax.broken});return false}b=b.responses[0];a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur();a("#bp-replysubmit .error").html("").hide();a("#bp-replysubmit .waiting").hide();a("#bp-activities-container").before(b.data);e=a("#activity-"+b.id);d=e.closest(".widefat").css("backgroundColor");e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})}};a(document).ready(activityReply.init)})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivitybpactivityadminphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-admin.php (5338 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-admin.php        2011-11-20 00:30:52 UTC (rev 5338)
+++ trunk/bp-activity/bp-activity-admin.php        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -41,6 +41,77 @@
</span><span class="cx"> add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * AJAX receiver for Activity replies via the admin screen. Adds a new activity
+ * comment, and returns HTML for a new table row.
+ *
+ * @since 1.6
+ */
+function bp_activity_admin_reply() {
+        // Check nonce
+        check_ajax_referer( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply' );
+
+        $parent_id = ! empty( $_REQUEST['parent_id'] ) ? (int) $_REQUEST['parent_id'] : 0;
+        $root_id = ! empty( $_REQUEST['root_id'] ) ? (int) $_REQUEST['root_id'] : 0;
+
+        // $parent_id is required
+        if ( empty( $parent_id ) )
+                die( '-1' );
+
+        // If $root_id not set (e.g. for root items), use $parent_id
+        if ( empty( $root_id ) )
+                $root_id = $parent_id;
+
+        // Check that a reply has been entered
+        if ( empty( $_REQUEST['content'] ) )
+                die( __( 'ERROR: Please type a reply.', 'buddypress' ) );
+
+        // Check parent activity exists
+        $parent_activity = new BP_Activity_Activity( $parent_id );
+        if ( empty( $parent_activity->component ) )
+                die( __( 'ERROR: The item you are trying to reply to cannot be found, or it has been deleted.', 'buddypress' ) );
+
+        // @todo: Check if user is allowed to create new activity items
+        // if ( ! current_user_can( 'bp_new_activity' ) )
+        if ( ! is_super_admin() )
+                die( '-1' );
+
+        // Add new activity comment
+        $new_activity_id = bp_activity_new_comment( array(
+                'activity_id' => $root_id, // ID of the root activity item
+                'content' => $_REQUEST['content'],
+                'parent_id' => $parent_id, // ID of a parent comment
+        ) );
+
+        // Fetch the new activity item, as we need it to create table markup to return
+        $new_activity = new BP_Activity_Activity( $new_activity_id );
+
+        // This needs to be set for the BP_Activity_List_Table constructor to work
+        set_current_screen( 'toplevel_page_bp-activity' );
+
+        // Set up an output buffer
+        ob_start();
+        $list_table = new BP_Activity_List_Table();
+        $list_table->single_row( (array) $new_activity );
+
+        // Get table markup
+        $response = array(
+                'data' => ob_get_contents(),
+                'id' => $new_activity_id,
+                'position' => -1,
+                'what' => 'bp_activity',
+        );
+        ob_end_clean();
+
+        // Send response
+        $r = new WP_Ajax_Response();
+        $r->add( $response );
+        $r->send();
+
+        exit();
+}
+add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
+
+/**
</ins><span class="cx"> * Handle save/update of screen options for the Activity component admin screen
</span><span class="cx"> *
</span><span class="cx"> * @param string $value Will always be false unless another plugin filters it first.
</span><span class="lines">@@ -87,6 +158,16 @@
</span><span class="cx">                 '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
</span><span class="cx">         );
</span><span class="cx">
</span><ins>+        // Enqueue CSS and JavaScript
+        if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
+                wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . 'bp-activity/admin/js/admin.dev.js', array( 'jquery', 'wp-ajax-response' ), '20111120' );
+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . 'bp-activity/admin/css/admin.dev.css', array(), '20111120' );
+
+        } else {
+                wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . 'bp-activity/admin/js/admin.js', array( 'jquery', 'wp-ajax-response' ), '20111120' );
+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . 'bp-activity/admin/css/admin.css', array(), '20111120' );
+        }
+
</ins><span class="cx">         // Create the Activity screen list table
</span><span class="cx">         $bp_activity_list_table = new BP_Activity_List_Table();
</span><span class="cx">
</span><span class="lines">@@ -95,7 +176,7 @@
</span><span class="cx">         if ( $doaction && 'edit' != $doaction ) {
</span><span class="cx">
</span><span class="cx">                 // Build redirection URL
</span><del>-                $redirect_to = remove_query_arg( array( 'aid', 'deleted', 'spammed', 'unspammed', ), wp_get_referer() );
</del><ins>+                $redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
</ins><span class="cx">                 $redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
</span><span class="cx">
</span><span class="cx">                 // Get activity IDs
</span><span class="lines">@@ -119,6 +200,9 @@
</span><span class="cx">                 // Initialise counters for how many of each type of item we perform an action on
</span><span class="cx">                 $deleted = $spammed = $unspammed = 0;
</span><span class="cx">
</span><ins>+                // Store any error that occurs when updating the database item
+                $error = 0;
+
</ins><span class="cx">                 // "We'd like to shoot the monster, could you move, please?"
</span><span class="cx">                 foreach ( $activity_ids as $activity_id ) {
</span><span class="cx">                         // @todo: Check the permissions on each
</span><span class="lines">@@ -142,14 +226,27 @@
</span><span class="cx">
</span><span class="cx">                                 case 'ham' :
</span><span class="cx">                                         bp_activity_mark_as_ham( $activity );
</span><del>-                                        $activity->save();
</del><ins>+                                        $result = $activity->save();
</ins><span class="cx">
</span><ins>+                                        // Check for any error during activity save
+                                        if ( ! $result ) {
+                                                $error = $activity->id;
+                                                break;
+                                        }
+
+                                        $unspammed++;
</ins><span class="cx">                                         break;
</span><span class="cx">
</span><span class="cx">                                 case 'spam' :
</span><span class="cx">                                         bp_activity_mark_as_spam( $activity );
</span><del>-                                        $activity->save();
</del><ins>+                                        $result = $activity->save();
</ins><span class="cx">
</span><ins>+                                        // Check for any error during activity save
+                                        if ( ! $result ) {
+                                                $error = $activity->id;
+                                                break;
+                                        }
+
</ins><span class="cx">                                         $spammed++;
</span><span class="cx">                                         break;
</span><span class="cx">
</span><span class="lines">@@ -157,6 +254,10 @@
</span><span class="cx">                                         break;
</span><span class="cx">                         }
</span><span class="cx">
</span><ins>+                        // If an error occured, don't bother looking at the other activities. Bail out of the foreach.
+                        if ( $error )
+                                break;
+
</ins><span class="cx">                         // Release memory
</span><span class="cx">                         unset( $activity );
</span><span class="cx">                 }
</span><span class="lines">@@ -171,6 +272,10 @@
</span><span class="cx">                 if ( $deleted )
</span><span class="cx">                         $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
</span><span class="cx">
</span><ins>+                // If an error occured, pass back the activity ID that failed
+                if ( $error )
+                        $redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
+
</ins><span class="cx">                 // Redirect
</span><span class="cx">                 wp_redirect( $redirect_to );
</span><span class="cx">                 exit;
</span><span class="lines">@@ -194,14 +299,18 @@
</span><span class="cx">         $messages = array();
</span><span class="cx">
</span><span class="cx">         // If the user has just made a change to an activity item, build status messages
</span><del>-        if ( !empty( $_REQUEST['deleted'] ) || !empty( $_REQUEST['spammed'] ) || !empty( $_REQUEST['unspammed'] ) ) {
</del><ins>+        if ( !empty( $_REQUEST['deleted'] ) || !empty( $_REQUEST['spammed'] ) || !empty( $_REQUEST['unspammed'] ) || !empty( $_REQUEST['error'] ) ) {
</ins><span class="cx">                 $deleted = !empty( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
</span><ins>+                $error = !empty( $_REQUEST['error'] ) ? (int) $_REQUEST['error'] : 0;
</ins><span class="cx">                 $spammed = !empty( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0;
</span><span class="cx">                 $unspammed = !empty( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
</span><span class="cx">
</span><span class="cx">                 if ( $deleted > 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s activity was permanently deleted.', '%s activities were permanently deleted.', $deleted, 'buddypress' ), $deleted );
</span><span class="cx">
</span><ins>+                if ( $error > 0 )
+                        $messages[] = sprintf( __( 'An error occured when updating Activity ID #%d.', 'buddypress' ), $error );
+
</ins><span class="cx">                 if ( $spammed > 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s activity marked as spam.', '%s activities marked as spam.', $spammed, 'buddypress' ), $spammed );
</span><span class="cx">
</span><span class="lines">@@ -234,7 +343,7 @@
</span><span class="cx">
</span><span class="cx">                 <?php // If the user has just made a change to an activity item, display the status messages ?>
</span><span class="cx">                 <?php if ( !empty( $messages ) ) : ?>
</span><del>-                        <div id="moderated" class="updated"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
</del><ins>+                        <div id="moderated" class="<?php echo ( ! empty( $_REQUEST['error'] ) ) ? 'error' : 'updated'; ?>"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
</ins><span class="cx">                 <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                 <?php $bp_activity_list_table->views(); ?>
</span><span class="lines">@@ -245,6 +354,30 @@
</span><span class="cx">                         <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
</span><span class="cx">                         <?php $bp_activity_list_table->display(); ?>
</span><span class="cx">                 </form>
</span><ins>+
+                <table style="display: none;">
+                        <tr id="bp-activities-container" style="display: none;">
+                                <td colspan="4">
+                                        <form method="get" action="">
+
+                                                <h5 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h5>
+                                                <?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
+
+                                                <p id="bp-replysubmit" class="submit">
+                                                        <a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'tmggc' ); ?></a>
+                                                        <a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'tmggc' ); ?></a>
+
+                                                        <img class="waiting" style="display:none;" src="<?php echo esc_url( network_admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
+                                                        <span class="error" style="display:none;"></span>
+                                                        <br class="clear" />
+                                                </p>
+
+                                                <?php wp_nonce_field( 'bp-activity-admin-reply', '_ajax_nonce-bp-activity-admin-reply', false ); ?>
+
+                                        </form>
+                                </td>
+                        </tr>
+                </table>
</ins><span class="cx">         </div>
</span><span class="cx">
</span><span class="cx"> <?php
</span><span class="lines">@@ -436,6 +569,21 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Generates content for a single row of the table
+         *
+         * @param object $item The current item
+         * @since 1.6
+         */
+        function single_row( $item ) {
+                static $row_class = '';
+                $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
+
+                echo '<tr' . $row_class . ' id="activity-' . esc_attr( $item['id'] ) . '" data-parent_id="' . esc_attr( $item['id'] ) . '" data-root_id="' . esc_attr( $item['item_id'] ) . '">';
+                echo $this->single_row_columns( $item );
+                echo '</tr>';
+        }
+
+        /**
</ins><span class="cx">          * Get the list of views available on this table (e.g. "all", "spam").
</span><span class="cx">          *
</span><span class="cx">          * @since 1.6
</span><span class="lines">@@ -450,7 +598,7 @@
</span><span class="cx">         <?php
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        /**
</del><ins>+                /**
</ins><span class="cx">          * Get bulk actions
</span><span class="cx">          *
</span><span class="cx">          * @return array Key/value pairs for the bulk actions dropdown
</span><span class="lines">@@ -598,19 +746,20 @@
</span><span class="cx">                 $base_url = network_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
</span><span class="cx">                 $spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
</span><span class="cx">
</span><del>-                $delete_url = $base_url . "&amp;action=delete&$spam_nonce";
</del><ins>+                $delete_url = $base_url . "&amp;action=delete&amp;$spam_nonce";
</ins><span class="cx">                 $edit_url = $base_url . '&amp;action=edit';
</span><del>-                $ham_url = $base_url . "&amp;action=ham&$spam_nonce";
-                $spam_url = $base_url . "&amp;action=spam&$spam_nonce";
</del><ins>+                $ham_url = $base_url . "&amp;action=ham&amp;$spam_nonce";
+                $spam_url = $base_url . "&amp;action=spam&amp;$spam_nonce";
</ins><span class="cx">
</span><span class="cx">                 // Rollover actions
</span><span class="cx">
</span><span class="cx">                 // Reply - javascript only; implemented by AJAX.
</span><del>-                if ( 'spam' != $item_status )
-                        $actions['reply'] = sprintf( '<a href="%s" class="reply hide-if-no-js">%s</a>', $base_url, __( 'Reply', 'buddypress' ) );
</del><ins>+                if ( 'spam' != $item_status ) {
+                        $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
</ins><span class="cx">
</span><del>-                // Edit
-                $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
</del><ins>+                        // Edit
+                        $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
+                }
</ins><span class="cx">
</span><span class="cx">                 // Spam/unspam
</span><span class="cx">                 if ( 'spam' == $item_status )
</span></span></pre></div>
<a id="trunkreadmetxt"></a>
<div class="modfile"><h4>Modified: trunk/readme.txt (5338 => 5339)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/readme.txt        2011-11-20 00:30:52 UTC (rev 5338)
+++ trunk/readme.txt        2011-11-20 23:39:56 UTC (rev 5339)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> === Plugin Name ===
</span><span class="cx"> Contributors: apeatling, johnjamesjacoby, MrMaz, DJPaul, boonebgorges
</span><span class="cx"> Tags: buddypress, social networking, activity, profiles, messaging, friends, groups, forums, microblogging, twitter, facebook, social, community, networks, networking, cms
</span><del>-Requires at least: 3.2
-Tested up to: 3.2.1
</del><ins>+Requires at least: 3.3
+Tested up to: 3.3
</ins><span class="cx"> Stable tag: 1.5
</span><span class="cx">
</span><span class="cx"> Social networking in a box. Build a social network for your company, school, sports team or niche community.
</span></span></pre>
</div>
</div>
</body>
</html>