<!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 "n activities per screen" 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 "bp_activity_use_akismet" 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() && ! empty( $_REQUEST['page'] ) && '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' ) && 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->current_action() && !empty( $_GET['aid'] ) ) {
-                // @todo Contextual help for the edit screen
</del><ins>+        if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) ) {
+                get_current_screen()->add_help_tab( array(
+                        'id' => 'bp-activity-edit-overview',
+                        'title' => __( 'Overview', 'buddypress' ),
+                        'content' =>
+                                '<p>' . __( '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' ) . '</p>' .
+                                '<p>' . __( 'You can also moderate the activity from this screen using the Status box, where you can also change the timestamp of the activity.', 'buddypress' ) . '</p>'
+                ) );
</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 . "bp-activity/admin/css/admin.{$dev}css", 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' => _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">                                 '<p>' . __( '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' ) . '</p>'
</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()->add_help_tab( array(
</span><span class="cx">                         'id'                => 'bp-activity-moderating',
</span><span class="cx">                         'title'                => __( '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' ) && SCRIPT_DEBUG ) ? 'dev.' : '';
</del><span class="cx">                 wp_enqueue_script( 'bp_activity_admin_js', BP_PLUGIN_URL . "bp-activity/admin/js/admin.{$dev}js", array( 'jquery', 'wp-ajax-response' ), '20111120' );
</span><del>-                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111126' );
</del><ins>+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", 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->current_action();
-        if ( $doaction && 'edit' != $doaction ) {
</del><ins>+        if ( $doaction && ! 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 && '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->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->is_spam;
+                        $new_spam_status = ( 'spam' == $_REQUEST['activity_status'] ) ? 1 : 0;
+                }
+
+                // Activity action
+                if ( ! empty( $_REQUEST['bp-activities-action'] ) && stripslashes( $activity->action ) != stripslashes( $_REQUEST['bp-activities-action'] ) ) {
+                        $activity->action = $_REQUEST['bp-activities-action'];
+                        $tainted = true;
+                }
+
+                // Activity content
+                if ( ! empty( $_REQUEST['bp-activities-content'] ) && stripslashes( $activity->content ) != stripslashes( $_REQUEST['bp-activities-content'] ) ) {
+                        $activity->content = $_REQUEST['bp-activities-content'];
+                        $tainted = true;
+                }
+
+                // Activity timestamp
+                if ( ! empty( $_REQUEST['aa'] ) && ! empty( $_REQUEST['mm'] ) && ! empty( $_REQUEST['jj'] ) && ! empty( $_REQUEST['hh'] ) && ! empty( $_REQUEST['mn'] ) && ! empty( $_REQUEST['ss'] ) ) {
+                        $aa = $_REQUEST['aa'];
+                        $mm = $_REQUEST['mm'];
+                        $jj = $_REQUEST['jj'];
+                        $hh = $_REQUEST['hh'];
+                        $mn = $_REQUEST['mn'];
+                        $ss = $_REQUEST['ss'];
+                        $aa = ( $aa <= 0 ) ? date( 'Y' ) : $aa;
+                        $mm = ( $mm <= 0 ) ? date( 'n' ) : $mm;
+                        $jj = ( $jj > 31 ) ? 31 : $jj;
+                        $jj = ( $jj <= 0 ) ? date( 'j' ) : $jj;
+                        $hh = ( $hh > 23 ) ? $hh -24 : $hh;
+                        $mn = ( $mn > 59 ) ? $mn -60 : $mn;
+                        $ss = ( $ss > 59 ) ? $ss -60 : $ss;
+
+                        // Reconstruct the date into a timestamp. Convert it to GMT.
+                        $gmt_date = get_gmt_from_date( sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ) );
+
+                        if ( $activity->date_recorded != $gmt_date ) {
+                                $activity->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->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 && $tainted )
+                        $error = $activity->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->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->current_action() && !empty( $_GET['aid'] ) )
</del><ins>+        if ( 'edit' == $doaction && ! 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' => ! empty( $_REQUEST['aid'] ) ? (int) $_REQUEST['aid'] : 0,
+                'max' => 1,
+                'show_hidden' => true,
+                'spam' => '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']->comment_date = $activity->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 );
+?>
+
+        <div class="wrap">
+                <?php screen_icon( 'buddypress' ); ?>
+                <h2><?php printf( __( 'Editing Activity (ID #%s)', 'buddypress' ), number_format_i18n( (int) $_REQUEST['aid'] ) ); ?></h2>
+
+                <?php if ( ! empty( $activity ) ) : ?>
+
+                        <form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
+                                <div id="poststuff" class="metabox-holder has-right-sidebar">
+                                        <div id="side-info-column" class="inner-sidebar">
+                                                <?php do_meta_boxes( 'toplevel_page_bp-activity', 'side', $activity ); ?>
+                                        </div>
+
+                                        <div id="post-body" class="has-sidebar">
+                                                <div id="post-body-content" class="has-sidebar-content">
+                                                        <div id="postdiv" class="postarea">
+                                                                <?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), ) ); ?>
+
+                                                                <?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), ) ); ?>
+                                                        </div>
+
+                                                        <?php do_meta_boxes( 'toplevel_page_bp-activity', 'advanced', $activity ); ?>
+                                                </div>
+                                        </div>
+                                </div>
+
+                                <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
+                                <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
+                                <?php wp_nonce_field( 'edit-activity_' . $activity->id ); ?>
+                        </form>
+
+                <?php else : ?>
+                        <p><?php printf( __( 'No activity found with this ID. <a href="%s">Go back and try again</a>.', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity' ) ); ?></p>
+                <?php endif; ?>
+
+        </div>
+
+<?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 ) {
+?>
+
+        <div class="submitbox" id="submitcomment">
+
+                <div id="minor-publishing">
+                        <div id="minor-publishing-actions">
+                                <div id="preview-action">
+                                        <a class="button preview" href="<?php echo esc_attr( bp_activity_get_permalink( $item->id, $item ) ); ?>" target="_blank"><?php _e( 'View Activity', 'buddypress' ); ?></a>
+                                </div>
+
+                                <div class="clear"></div>
+                        </div><!-- #minor-publishing-actions -->
+
+                        <div id="misc-publishing-actions">
+                                <div class="misc-pub-section" id="comment-status-radio">
+                                        <label class="approved"><input type="radio" name="activity_status" value="ham" <?php checked( $item->is_spam, 0 ); ?>><?php _e( 'Approved', 'buddypress' ); ?></label><br />
+                                        <label class="spam"><input type="radio" name="activity_status" value="spam" <?php checked( $item->is_spam, 1 ); ?>><?php _e( 'Spam', 'buddypress' ); ?></label>
+                                </div>
+
+                                <div class="misc-pub-section curtime misc-pub-section-last">
+                                        <?php
+                                        // translators: Publish box date format, see http://php.net/date
+                                        $datef = __( 'M j, Y @ G:i', 'buddypress' );
+                                        $date = date_i18n( $datef, strtotime( $item->date_recorded ) );
+                                        ?>
+                                        <span id="timestamp"><?php printf( __( 'Submitted on: <strong>%1$s</strong>', 'buddypress' ), $date ); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e( 'Edit', 'buddypress' ); ?></a>
+
+                                        <div id='timestampdiv' class='hide-if-js'>
+                                                <?php touch_time( 1, 0, 5 ); ?>
+                                        </div><!-- #timestampdiv -->
+                                </div>
+                        </div> <!-- #misc-publishing-actions -->
+
+                        <div class="clear"></div>
+                </div><!-- #minor-publishing -->
+
+                <div id="major-publishing-actions">
+                        <div id="publishing-action">
+                                <?php submit_button( __( 'Update', 'buddypress' ), 'primary', 'save', false, array( 'tabindex' => '4' ) ); ?>
+                        </div>
+                        <div class="clear"></div>
+                </div><!-- #major-publishing-actions -->
+
+        </div><!-- #submitcomment -->
+
+<?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 > 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 > 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 > 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' => $activities['total'],
</span><span class="cx">                         'total_pages' => 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 '</div>';
</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' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) )
</del><ins>+                if ( defined( 'AKISMET_VERSION' ) && ( !empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && 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>