<!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][5435] trunk/bp-activity: Activity admin iteration.</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/5435">5435</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-12-03 15:42:58 +0000 (Sat, 03 Dec 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Activity admin iteration. See <a href="http://buddypress.trac.wordpress.org/ticket/3660">#3660</a>.
* Fix &quot;n activities per screen&quot; option not working (and only load on the index screen).
* Fix activity type filter drop down.
* Fix PHP warnings when the index screen tried to truncate activity item's contents.
* Add &quot;bp_activity_use_akismet&quot; filter to allow Akismet integration with Activity to be disabled.
* Add first version of the Activity edit screen, and its contextual help text.</pre>

<h3>Modified Paths</h3>
<ul>
<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><a href="#trunkbpactivitybpactivityadminphp">trunk/bp-activity/bp-activity-admin.php</a></li>
<li><a href="#trunkbpactivitybpactivityloaderphp">trunk/bp-activity/bp-activity-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityadmincssadmincss"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/admin/css/admin.css (5434 => 5435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.css        2011-12-01 22:31:10 UTC (rev 5434)
+++ trunk/bp-activity/admin/css/admin.css        2011-12-03 15:42:58 UTC (rev 5435)
</span><span class="lines">@@ -1 +1 @@
</span><del>-#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;}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px;}
</del><span class="cx">\ No newline at end of file
</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;}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px;}#wp-bp-activities-content-wrap{margin-top:20px;}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px;}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpactivityadmincssadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/admin/css/admin.dev.css (5434 => 5435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.dev.css        2011-12-01 22:31:10 UTC (rev 5434)
+++ trunk/bp-activity/admin/css/admin.dev.css        2011-12-03 15:42:58 UTC (rev 5435)
</span><span class="lines">@@ -29,4 +29,13 @@
</span><span class="cx">         float: left;
</span><span class="cx">         margin-right: 10px;
</span><span class="cx">         margin-top: 1px;
</span><ins>+}
+
+#wp-bp-activities-content-wrap {
+        margin-top: 20px;
+}
+#post-body #bp-activities-action_resize,
+#post-body #bp-activities-content_resize {
+        position: inherit;
+        margin-top: -2px;
</ins><span class="cx"> }
</span><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 (5434 => 5435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-admin.php        2011-12-01 22:31:10 UTC (rev 5434)
+++ trunk/bp-activity/bp-activity-admin.php        2011-12-03 15:42:58 UTC (rev 5435)
</span><span class="lines">@@ -17,7 +17,8 @@
</span><span class="cx"> if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
</span><span class="cx"> 
</span><span class="cx"> // per_page screen option. Has to be hooked in extremely early.
</span><del>-add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 );
</del><ins>+if ( is_admin() &amp;&amp; ! empty( $_REQUEST['page'] ) &amp;&amp; 'bp-activity' == $_REQUEST['page'] )
+        add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Registers the Activity component admin screen
</span><span class="lines">@@ -121,7 +122,7 @@
</span><span class="cx">  * @since 1.6
</span><span class="cx">  */
</span><span class="cx"> function bp_activity_admin_screen_options( $value, $option, $new_value ) {
</span><del>-        if ( 'toplevel_page_bp_activity_settings_per_page' != $option )
</del><ins>+        if ( 'toplevel_page_bp_activity_per_page' != $option )
</ins><span class="cx">                 return $value;
</span><span class="cx"> 
</span><span class="cx">         // Per page
</span><span class="lines">@@ -141,15 +142,38 @@
</span><span class="cx"> function bp_activity_admin_load() {
</span><span class="cx">         global $bp_activity_list_table;
</span><span class="cx"> 
</span><del>-        // Create the Activity screen list table
-        $bp_activity_list_table = new BP_Activity_List_Table();
</del><ins>+        // Decide whether to load the dev version of the CSS and JavaScript
+        $dev = ( defined( 'SCRIPT_DEBUG' ) &amp;&amp; SCRIPT_DEBUG ) ? 'dev.' : '';
</ins><span class="cx"> 
</span><ins>+        // Decide whether to load the index or edit screen
+        $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
+
</ins><span class="cx">         // Edit screen
</span><del>-        if ( 'edit' == $bp_activity_list_table-&gt;current_action() &amp;&amp; !empty( $_GET['aid'] ) ) {
-                // @todo Contextual help for the edit screen
</del><ins>+        if ( 'edit' == $doaction &amp;&amp; ! empty( $_GET['aid'] ) ) {
+                get_current_screen()-&gt;add_help_tab( array(
+                        'id'      =&gt; 'bp-activity-edit-overview',
+                        'title'   =&gt; __( 'Overview', 'buddypress' ),
+                        'content' =&gt;
+                                '&lt;p&gt;' . __( 'You can edit activities made on your site similar to the way you edit a comment. This is useful if you need to change which page the activity links to, or when you notice that the author has made a typographical error.', 'buddypress' ) . '&lt;/p&gt;' .
+                                '&lt;p&gt;' . __( 'You can also moderate the activity from this screen using the Status box, where you can also change the timestamp of the activity.', 'buddypress' ) . '&lt;/p&gt;'
+                ) );
</ins><span class="cx"> 
</span><ins>+                // Register metaboxes for the edit screen.
+                add_meta_box( 'submitdiv', _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', 'toplevel_page_bp-activity', 'side', 'core' );
+
+                // Enqueue javascripts
+                wp_enqueue_script( 'postbox' );
+                wp_enqueue_script( 'dashboard' );
+                wp_enqueue_script( 'comment' );
+
+                // Enqueue CSS
+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . &quot;bp-activity/admin/css/admin.{$dev}css&quot;, array(), '20111203' );
+
</ins><span class="cx">         // Index screen
</span><span class="cx">         } else {
</span><ins>+                // Create the Activity screen list table
+                $bp_activity_list_table = new BP_Activity_List_Table();
+
</ins><span class="cx">                 // per_page screen option
</span><span class="cx">                 add_screen_option( 'per_page', array( 'label' =&gt; _x( 'Activities', 'Activity items per page (screen options)', 'buddypress' )) );
</span><span class="cx"> 
</span><span class="lines">@@ -162,7 +186,7 @@
</span><span class="cx">                                 '&lt;p&gt;' . __( 'There are many different types of activities. Some are generated automatically by BuddyPress and other plugins, and some are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '&lt;/p&gt;'
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><del>-        // Help panel - moderation text
</del><ins>+                // Help panel - moderation text
</ins><span class="cx">                 get_current_screen()-&gt;add_help_tab( array(
</span><span class="cx">                         'id'                =&gt; 'bp-activity-moderating',
</span><span class="cx">                         'title'                =&gt; __( 'Moderating Activities', 'buddypress' ),
</span><span class="lines">@@ -174,9 +198,8 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 // Enqueue CSS and JavaScript
</span><del>-                $dev = ( defined( 'SCRIPT_DEBUG' ) &amp;&amp; SCRIPT_DEBUG ) ? 'dev.' : '';
</del><span class="cx">                 wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . &quot;bp-activity/admin/js/admin.{$dev}js&quot;, array( 'jquery', 'wp-ajax-response' ), '20111120' );
</span><del>-                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . &quot;bp-activity/admin/css/admin.{$dev}css&quot;, array(), '20111126' );
</del><ins>+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . &quot;bp-activity/admin/css/admin.{$dev}css&quot;, array(), '20111203' );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Help panel - sidebar links
</span><span class="lines">@@ -186,8 +209,7 @@
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         // Handle spam/un-spam/delete of activities
</span><del>-        $doaction = $bp_activity_list_table-&gt;current_action();
-        if ( $doaction &amp;&amp; 'edit' != $doaction ) {
</del><ins>+        if ( $doaction &amp;&amp; ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
</ins><span class="cx"> 
</span><span class="cx">                 // Build redirection URL
</span><span class="cx">                 $redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
</span><span class="lines">@@ -294,6 +316,109 @@
</span><span class="cx">                 wp_redirect( $redirect_to );
</span><span class="cx">                 exit;
</span><span class="cx"> 
</span><ins>+
+        // Save the edit
+        } elseif ( $doaction &amp;&amp; 'save' == $doaction ) {
+                // Build redirection URL
+                $redirect_to = remove_query_arg( array( 'action', 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
+
+                // Get activity ID
+                $activity_id = (int) $_REQUEST['aid'];
+
+                // Check this is a valid form submission
+                check_admin_referer( 'edit-activity_' . $activity_id );
+
+                // Get the activity from the database
+                $activity = new BP_Activity_Activity( $activity_id );
+
+                // If the activity doesn't exist, just redirect back to the index
+                if ( empty( $activity-&gt;component ) ) {
+                        wp_redirect( $redirect_to );
+                        exit;
+                }
+
+                // Check the form for the updated properties
+
+                // Store any error that occurs when updating the database item
+                $error = 0;
+
+                // Set tainted if a new form value is different from the object's old value
+                $tainted = false;
+                
+                // Activity spam status
+                if ( ! empty( $_REQUEST['activity_status'] ) ) {
+                        $prev_spam_status = $activity-&gt;is_spam;
+                        $new_spam_status  = ( 'spam' == $_REQUEST['activity_status'] ) ? 1 : 0;
+                }
+
+                // Activity action
+                if ( ! empty( $_REQUEST['bp-activities-action'] ) &amp;&amp; stripslashes( $activity-&gt;action ) != stripslashes( $_REQUEST['bp-activities-action'] ) ) {
+                        $activity-&gt;action = $_REQUEST['bp-activities-action'];
+                        $tainted = true;
+                }
+
+                // Activity content
+                if ( ! empty( $_REQUEST['bp-activities-content'] ) &amp;&amp; stripslashes( $activity-&gt;content ) != stripslashes( $_REQUEST['bp-activities-content'] ) ) {
+                        $activity-&gt;content = $_REQUEST['bp-activities-content'];
+                        $tainted = true;
+                }
+
+                // Activity timestamp
+                if ( ! empty( $_REQUEST['aa'] ) &amp;&amp; ! empty( $_REQUEST['mm'] ) &amp;&amp; ! empty( $_REQUEST['jj'] ) &amp;&amp; ! empty( $_REQUEST['hh'] ) &amp;&amp; ! empty( $_REQUEST['mn'] ) &amp;&amp; ! empty( $_REQUEST['ss'] ) ) {
+                        $aa = $_REQUEST['aa'];
+                        $mm = $_REQUEST['mm'];
+                        $jj = $_REQUEST['jj'];
+                        $hh = $_REQUEST['hh'];
+                        $mn = $_REQUEST['mn'];
+                        $ss = $_REQUEST['ss'];
+                        $aa = ( $aa &lt;= 0 ) ? date( 'Y' ) : $aa;
+                        $mm = ( $mm &lt;= 0 ) ? date( 'n' ) : $mm;
+                        $jj = ( $jj &gt; 31 ) ? 31 : $jj;
+                        $jj = ( $jj &lt;= 0 ) ? date( 'j' ) : $jj;
+                        $hh = ( $hh &gt; 23 ) ? $hh -24 : $hh;
+                        $mn = ( $mn &gt; 59 ) ? $mn -60 : $mn;
+                        $ss = ( $ss &gt; 59 ) ? $ss -60 : $ss;
+
+                        // Reconstruct the date into a timestamp. Convert it to GMT.
+                        $gmt_date = get_gmt_from_date( sprintf( &quot;%04d-%02d-%02d %02d:%02d:%02d&quot;, $aa, $mm, $jj, $hh, $mn, $ss ) );
+
+                        if ( $activity-&gt;date_recorded != $gmt_date ) {
+                                $activity-&gt;date_recorded = $gmt_date;
+                                $tainted = true;
+                        }
+                }
+
+                // Has the spam status has changed?
+                if ( $prev_spam_status != $new_spam_status ) {
+                        if ( 1 == $new_spam_status)
+                                bp_activity_mark_as_spam( $activity );
+                        else
+                                bp_activity_mark_as_ham( $activity );
+
+                        $tainted = true;
+                }
+
+                // Save
+                $result = $activity-&gt;save();
+
+                // Clear the activity stream first page cache, in case this activity's timestamp was changed
+                wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
+
+                // Check for any error during activity save
+                if ( ! $result &amp;&amp; $tainted )
+                        $error = $activity-&gt;id;
+
+                // If an error occured, pass back the activity ID that failed
+                if ( $error )
+                        $redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
+                else
+                        $redirect_to = add_query_arg( 'updated', (int) $activity-&gt;id, $redirect_to );
+
+                // Redirect
+                wp_redirect( $redirect_to );
+                exit;
+
+
</ins><span class="cx">         // If a referrer and a nonce is supplied, but no action, redirect back.
</span><span class="cx">         } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
</span><span class="cx">                 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
</span><span class="lines">@@ -304,14 +429,14 @@
</span><span class="cx"> /**
</span><span class="cx">  * Outputs the Activity component admin screens
</span><span class="cx">  *
</span><del>- * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
</del><span class="cx">  * @since 1.6
</span><span class="cx">  */
</span><span class="cx"> function bp_activity_admin() {
</span><del>-        global $bp_activity_list_table;
</del><ins>+        // Decide whether to load the index or edit screen
+        $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
</ins><span class="cx"> 
</span><span class="cx">         // Display the single activity edit screen
</span><del>-        if ( 'edit' == $bp_activity_list_table-&gt;current_action() &amp;&amp; !empty( $_GET['aid'] ) )
</del><ins>+        if ( 'edit' == $doaction &amp;&amp; ! empty( $_GET['aid'] ) )
</ins><span class="cx">                 bp_activity_admin_edit();
</span><span class="cx"> 
</span><span class="cx">         // Otherwise, display the Activity index screen
</span><span class="lines">@@ -322,14 +447,132 @@
</span><span class="cx"> /**
</span><span class="cx">  * Display the single activity edit screen
</span><span class="cx">  *
</span><del>- * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
</del><span class="cx">  * @since 1.6
</span><span class="cx">  */
</span><span class="cx"> function bp_activity_admin_edit() {
</span><del>-        global $bp_activity_list_table;
</del><ins>+        // @todo: Check if user is allowed to edit activity items
+        // if ( ! current_user_can( 'bp_edit_activity' ) )
+        if ( ! is_super_admin() )
+                die( '-1' );
+
+        // Get the activity from the database
+        $activity = bp_activity_get( array(
+                'in'          =&gt; ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,
+                'max'         =&gt; 1,
+                'show_hidden' =&gt; true,
+                'spam'        =&gt; 'all',
+        ) );
+
+        if ( ! empty( $activity['activities'][0] ) ) {
+                $activity = $activity['activities'][0];
+
+                // Workaround to use WP's touch_time() without duplicating that function
+                $GLOBALS['comment'] = new stdClass;
+                $GLOBALS['comment']-&gt;comment_date = $activity-&gt;date_recorded;
+        } else {
+                $activity = '';
+        }
+
+        // Construct URL for form
+        $form_url = remove_query_arg( array( 'action', 'deleted', 'error', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
+        $form_url = add_query_arg( 'action', 'save', $form_url );
+?&gt;
+
+        &lt;div class=&quot;wrap&quot;&gt;
+                &lt;?php screen_icon( 'buddypress' ); ?&gt;
+                &lt;h2&gt;&lt;?php printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?&gt;&lt;/h2&gt;
+
+                &lt;?php if ( ! empty( $activity ) ) : ?&gt;
+
+                        &lt;form action=&quot;&lt;?php echo esc_attr( $form_url ); ?&gt;&quot; id=&quot;bp-activities-edit-form&quot; method=&quot;post&quot;&gt;
+                                &lt;div id=&quot;poststuff&quot; class=&quot;metabox-holder has-right-sidebar&quot;&gt;
+                                        &lt;div id=&quot;side-info-column&quot; class=&quot;inner-sidebar&quot;&gt;
+                                                &lt;?php do_meta_boxes( 'toplevel_page_bp-activity', 'side', $activity ); ?&gt;
+                                        &lt;/div&gt;
+
+                                        &lt;div id=&quot;post-body&quot; class=&quot;has-sidebar&quot;&gt;
+                                                &lt;div id=&quot;post-body-content&quot; class=&quot;has-sidebar-content&quot;&gt;
+                                                        &lt;div id=&quot;postdiv&quot; class=&quot;postarea&quot;&gt;
+                                                                &lt;?php wp_editor( stripslashes( $activity-&gt;action ), 'bp-activities-action', array( 'media_buttons' =&gt; false, 'textarea_rows' =&gt; 7, 'teeny' =&gt; true, 'quicktags' =&gt; array( 'buttons' =&gt; 'strong,em,link,block,del,ins,img,code,spell,close' ), ) ); ?&gt;
+
+                                                                &lt;?php wp_editor( stripslashes( $activity-&gt;content ), 'bp-activities-content', array( 'media_buttons' =&gt; false, 'teeny' =&gt; true, 'quicktags' =&gt; array( 'buttons' =&gt; 'strong,em,link,block,del,ins,img,code,spell,close' ), ) ); ?&gt;
+                                                        &lt;/div&gt;
+
+                                                        &lt;?php do_meta_boxes( 'toplevel_page_bp-activity', 'advanced', $activity ); ?&gt;
+                                                &lt;/div&gt;
+                                        &lt;/div&gt;
+                                &lt;/div&gt;
+
+                                &lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
+                                &lt;?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?&gt;
+                                &lt;?php wp_nonce_field( 'edit-activity_' . $activity-&gt;id ); ?&gt;
+                        &lt;/form&gt;
+
+                &lt;?php else : ?&gt;
+                        &lt;p&gt;&lt;?php printf( __( 'No activity found with this ID. &lt;a href=&quot;%s&quot;&gt;Go back and try again&lt;/a&gt;.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity' ) ); ?&gt;&lt;/p&gt;
+                &lt;?php endif; ?&gt;
+
+        &lt;/div&gt;
+
+&lt;?php
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Status metabox for the Activity admin edit screen
+ *
+ * @param object $item Activity item
+ * @since 1.6
+ */
+function bp_activity_admin_edit_metabox_status( $item ) {
+?&gt;
+
+        &lt;div class=&quot;submitbox&quot; id=&quot;submitcomment&quot;&gt;
+
+                &lt;div id=&quot;minor-publishing&quot;&gt;
+                        &lt;div id=&quot;minor-publishing-actions&quot;&gt;
+                                &lt;div id=&quot;preview-action&quot;&gt;
+                                        &lt;a class=&quot;button preview&quot; href=&quot;&lt;?php echo esc_attr( bp_activity_get_permalink( $item-&gt;id, $item ) ); ?&gt;&quot; target=&quot;_blank&quot;&gt;&lt;?php _e( 'View Activity', 'buddypress' ); ?&gt;&lt;/a&gt;
+                                &lt;/div&gt;
+
+                                &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+                        &lt;/div&gt;&lt;!-- #minor-publishing-actions --&gt;
+
+                        &lt;div id=&quot;misc-publishing-actions&quot;&gt;
+                                &lt;div class=&quot;misc-pub-section&quot; id=&quot;comment-status-radio&quot;&gt;
+                                        &lt;label class=&quot;approved&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;activity_status&quot; value=&quot;ham&quot; &lt;?php checked( $item-&gt;is_spam, 0 ); ?&gt;&gt;&lt;?php _e( 'Approved', 'buddypress' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                        &lt;label class=&quot;spam&quot;&gt;&lt;input type=&quot;radio&quot; name=&quot;activity_status&quot; value=&quot;spam&quot; &lt;?php checked( $item-&gt;is_spam, 1 ); ?&gt;&gt;&lt;?php _e( 'Spam', 'buddypress' ); ?&gt;&lt;/label&gt;
+                                &lt;/div&gt;
+
+                                &lt;div class=&quot;misc-pub-section curtime misc-pub-section-last&quot;&gt;
+                                        &lt;?php
+                                        // translators: Publish box date format, see http://php.net/date
+                                        $datef = __( 'M j, Y @ G:i', 'buddypress' );
+                                        $date  = date_i18n( $datef, strtotime( $item-&gt;date_recorded ) );
+                                        ?&gt;
+                                        &lt;span id=&quot;timestamp&quot;&gt;&lt;?php printf( __( 'Submitted on: &lt;strong&gt;%1$s&lt;/strong&gt;', 'buddypress' ), $date ); ?&gt;&lt;/span&gt;&amp;nbsp;&lt;a href=&quot;#edit_timestamp&quot; class=&quot;edit-timestamp hide-if-no-js&quot; tabindex='4'&gt;&lt;?php _e( 'Edit', 'buddypress' ); ?&gt;&lt;/a&gt;
+
+                                        &lt;div id='timestampdiv' class='hide-if-js'&gt;
+                                                &lt;?php touch_time( 1, 0, 5 ); ?&gt;
+                                        &lt;/div&gt;&lt;!-- #timestampdiv --&gt;
+                                &lt;/div&gt;
+                        &lt;/div&gt; &lt;!-- #misc-publishing-actions --&gt;
+
+                        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+                &lt;/div&gt;&lt;!-- #minor-publishing --&gt;
+
+                &lt;div id=&quot;major-publishing-actions&quot;&gt;
+                        &lt;div id=&quot;publishing-action&quot;&gt;
+                                &lt;?php submit_button( __( 'Update', 'buddypress' ), 'primary', 'save', false, array( 'tabindex' =&gt; '4' ) ); ?&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+                &lt;/div&gt;&lt;!-- #major-publishing-actions --&gt;
+
+        &lt;/div&gt;&lt;!-- #submitcomment --&gt;
+
+&lt;?php
+}
+
+/**
</ins><span class="cx">  * Display the Activity admin index screen, which contains a list of all the activities.
</span><span class="cx">  *
</span><span class="cx">  * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
</span><span class="lines">@@ -342,11 +585,12 @@
</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'] ) || !empty( $_REQUEST['error'] ) ) {
</del><ins>+        if ( ! empty( $_REQUEST['deleted'] ) || ! empty( $_REQUEST['spammed'] ) || ! empty( $_REQUEST['unspammed'] ) || ! empty( $_REQUEST['error'] ) || ! empty( $_REQUEST['updated'] ) ) {
</ins><span class="cx">                 $deleted   = !empty( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
</span><span class="cx">                 $error     = !empty( $_REQUEST['error']     ) ? (int) $_REQUEST['error']     : 0;
</span><span class="cx">                 $spammed   = !empty( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
</span><span class="cx">                 $unspammed = !empty( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
</span><ins>+                $updated   = !empty( $_REQUEST['updated'] )   ? (int) $_REQUEST['updated']   : 0;
</ins><span class="cx"> 
</span><span class="cx">                 if ( $deleted &gt; 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s activity was permanently deleted.', '%s activities were permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) );
</span><span class="lines">@@ -360,6 +604,8 @@
</span><span class="cx">                 if ( $unspammed &gt; 0 )
</span><span class="cx">                         $messages[] = sprintf( _n( '%s activity restored from the spam.', '%s activities restored from the spam.', $unspammed, 'buddypress' ), number_format_i18n( $unspammed ) );
</span><span class="cx"> 
</span><ins>+                if ( $updated &gt; 0 )
+                        $messages[] = __( 'The activity has been updated succesfully.', 'buddypress' );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Prepare the activity items for display
</span><span class="lines">@@ -562,6 +808,9 @@
</span><span class="cx">                         'total_items' =&gt; $activities['total'],
</span><span class="cx">                         'total_pages' =&gt; ceil( $activities['total'] / $per_page )
</span><span class="cx">                 ) );
</span><ins>+
+                // Don't truncate activity items; bp_activity_truncate_entry() needs to be used inside a BP_Activity_Template loop.
+                remove_filter( 'bp_get_activity_content_body', 'bp_activity_truncate_entry', 5 );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -837,7 +1086,7 @@
</span><span class="cx">                 echo '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx">                 // Get activity content - if not set, use the action
</span><del>-                if ( !empty( $item['content'] ) )
</del><ins>+                if ( ! empty( $item['content'] ) )
</ins><span class="cx">                         $content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
</span><span class="cx">                 else
</span><span class="cx">                         $content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
</span></span></pre></div>
<a id="trunkbpactivitybpactivityloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-loader.php (5434 => 5435)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-loader.php        2011-12-01 22:31:10 UTC (rev 5434)
+++ trunk/bp-activity/bp-activity-loader.php        2011-12-03 15:42:58 UTC (rev 5435)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // Load Akismet support if Akismet is configured
</span><span class="cx">                 $akismet_key = bp_get_option( 'wordpress_api_key' );
</span><del>-                if ( defined( 'AKISMET_VERSION' ) &amp;&amp; ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) )
</del><ins>+                if ( defined( 'AKISMET_VERSION' ) &amp;&amp; ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) &amp;&amp; apply_filters( 'bp_activity_use_akismet', true ) )
</ins><span class="cx">                         $includes[] = 'akismet';
</span><span class="cx"> 
</span><span class="cx">                 if ( is_admin() )
</span></span></pre>
</div>
</div>

</body>
</html>