<!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][5484] 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/5484">5484</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-12-10 18:19:44 +0000 (Sat, 10 Dec 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Activity admin iteration. See <a href="http://buddypress.trac.wordpress.org/ticket/3660">#3660</a>.
* Add remaining activity properties to the edit screen.
* Add new contextual help to the edit screen.
* Add support for 2 columns to the edit screen.
* Fix a typo (props fanquake, see <a href="http://buddypress.trac.wordpress.org/ticket/3822">#3822</a>).
* Update BP_Activity_Activity::save() method to fix a bug where an update operation with no changes was reported as an error.
* Update activity admin CSS, bump version number.</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="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.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 (5483 => 5484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.css        2011-12-10 18:16:23 UTC (rev 5483)
+++ trunk/bp-activity/admin/css/admin.css        2011-12-10 18:19:44 UTC (rev 5484)
</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;}#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;}
</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;}#bp_activity_link input{width:99%;}#bp-activities-primaryid{margin-bottom:1em;}
</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 (5483 => 5484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/admin/css/admin.dev.css        2011-12-10 18:16:23 UTC (rev 5483)
+++ trunk/bp-activity/admin/css/admin.dev.css        2011-12-10 18:19:44 UTC (rev 5484)
</span><span class="lines">@@ -38,4 +38,10 @@
</span><span class="cx"> #post-body #bp-activities-content_resize {
</span><span class="cx">         position: inherit;
</span><span class="cx">         margin-top: -2px;
</span><ins>+}
+#bp_activity_link input {
+        width: 99%;
+}
+#bp-activities-primaryid {
+        margin-bottom: 1em;
</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 (5483 => 5484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-admin.php        2011-12-10 18:16:23 UTC (rev 5483)
+++ trunk/bp-activity/bp-activity-admin.php        2011-12-10 18:19:44 UTC (rev 5484)
</span><span class="lines">@@ -134,13 +134,33 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Hide the advanced edit meta boxes by default, so we don't clutter the scren.
+ *
+ * @param WP_Screen $screen Screen identifier
+ * @return array Hidden Meta Boxes
+ * @since 1.0
+ */
+function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
+        if ( empty( $screen->id ) || 'toplevel_page_bp-activity' != $screen->id )
+                return $hidden;
+
+        // Hide the primary link meta box by default
+        $hidden = array_merge( (array) $hidden, array( 'bp_activity_itemids', 'bp_activity_link', 'bp_activity_type', 'bp_activity_userid', ) );
+
+        return apply_filters( 'bp_hide_meta_boxes', array_unique( $hidden ), $screen );
+}
+add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxes', 10, 2 );
+
+
+/**
</ins><span class="cx"> * Set up the admin page before any output is sent. Register contextual help and screen options for this admin page.
</span><span class="cx"> *
</span><ins>+ * @global object $bp BuddyPress global settings
</ins><span class="cx"> * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
</span><span class="cx"> * @since 1.6
</span><span class="cx"> */
</span><span class="cx"> function bp_activity_admin_load() {
</span><del>-        global $bp_activity_list_table;
</del><ins>+        global $bp, $bp_activity_list_table;
</ins><span class="cx">
</span><span class="cx">         // Decide whether to load the dev version of the CSS and JavaScript
</span><span class="cx">         $dev = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'dev.' : '';
</span><span class="lines">@@ -150,16 +170,41 @@
</span><span class="cx">
</span><span class="cx">         // Edit screen
</span><span class="cx">         if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) ) {
</span><ins>+                // columns screen option
+                add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) );
+
</ins><span class="cx">                 get_current_screen()->add_help_tab( array(
</span><span class="cx">                         'id' => 'bp-activity-edit-overview',
</span><span class="cx">                         'title' => __( 'Overview', 'buddypress' ),
</span><span class="cx">                         'content' =>
</span><del>-                                '<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>' .
</del><ins>+                                '<p>' . __( 'You 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>' . __( 'The two big editing areas for the activity title and content are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Primary Item/Secondary Item, Link, Type, Author ID) or to choose a 1- or 2-column layout for this screen.', 'buddypress' ) . '</p>' .
</ins><span class="cx">                                 '<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>'
</span><span class="cx">                 ) );
</span><span class="cx">
</span><ins>+                get_current_screen()->add_help_tab( array(
+                        'id' => 'bp-activity-edit-advanced',
+                        'title' => __( 'Item, Link, Type', 'buddypress' ),
+                        'content' =>
+                                '<p>' . __( '<strong>Primary Item/Secondary Item</strong> - These identify the object that created the activity. For example, the fields could reference a comment left on a specific site. Some types of activity may only use one, or none, of these fields.', 'buddypress' ) . '</p>' .
+                                '<p>' . __( '<strong>Link</strong> - Activity generated by blog posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item. Some types of activity may not use this field, even if it has been set.', 'buddypress' ) . '</p>' .
+                                '<p>' . __( '<strong>Type</strong> - Each distinct kind of activity has its own type. For example, <code>created_group</code> is used when a group is created and <code>joined_group</code> is used when a user joins a group.', 'buddypress' ) . '</p>' .
+                                '<p>' . __( 'For information about when and how BuddyPress uses all of these settings, see the Managing Activity link in the panel to the side.', 'buddypress' ) . '</p>'
+                ) );
+
+                // Help panel - sidebar links
+                get_current_screen()->set_help_sidebar(
+                        '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
+                        '<p>' . __( '<a href="http://codex.buddypress.org/buddypress-site-administration/managing-activity/">Managing Activity</a>', 'buddypress' ) . '</p>' .
+                        '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
+                );
+
</ins><span class="cx">                 // Register metaboxes for the edit screen.
</span><del>-                add_meta_box( 'submitdiv', _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', 'toplevel_page_bp-activity', 'side', 'core' );
</del><ins>+                add_meta_box( 'submitdiv', _x( 'Status', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_status', 'toplevel_page_bp-activity', 'side', 'core' );
+                add_meta_box( 'bp_activity_itemids', _x( 'Primary Item/Secondary Item', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_itemids', 'toplevel_page_bp-activity', 'advanced', 'core' );
+                add_meta_box( 'bp_activity_link', _x( 'Link', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_link', 'toplevel_page_bp-activity', 'advanced', 'core' );
+                add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', 'toplevel_page_bp-activity', 'advanced', 'core' );
+                add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', 'toplevel_page_bp-activity', 'advanced', 'core' );
</ins><span class="cx">
</span><span class="cx">                 // Enqueue javascripts
</span><span class="cx">                 wp_enqueue_script( 'postbox' );
</span><span class="lines">@@ -167,7 +212,7 @@
</span><span class="cx">                 wp_enqueue_script( 'comment' );
</span><span class="cx">
</span><span class="cx">                 // Enqueue CSS
</span><del>-                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111203' );
</del><ins>+                wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111210' );
</ins><span class="cx">
</span><span class="cx">         // Index screen
</span><span class="cx">         } else {
</span><span class="lines">@@ -191,23 +236,21 @@
</span><span class="cx">                         'id'                => 'bp-activity-moderating',
</span><span class="cx">                         'title'                => __( 'Moderating Activity', 'buddypress' ),
</span><span class="cx">                         'content'        =>
</span><del>-                                '<ul>' .
-                                        '<li>' . __( 'In the <strong>Activity</strong> column, above each activity it says &#8220;Submitted on,&#8221; followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress' ) . '</li>' .
-                                        '<li>' . __( "In the <strong>In Response To</strong> column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress' ) . '</li>' .
-                                '</ul>'
</del><ins>+                                '<p>' . __( 'In the <strong>Activity</strong> column, above each activity it says &#8220;Submitted on,&#8221; followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress' ) . '</p>' .
+                                '<p>' . __( "In the <strong>In Response To</strong> column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress' ) . '</p>'
</ins><span class="cx">                 ) );
</span><span class="cx">
</span><ins>+                // Help panel - sidebar links
+                get_current_screen()->set_help_sidebar(
+                        '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
+                        '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
+                );
+
</ins><span class="cx">                 // Enqueue CSS and JavaScript
</span><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><span class="cx">                 wp_enqueue_style( 'bp_activity_admin_css', BP_PLUGIN_URL . "bp-activity/admin/css/admin.{$dev}css", array(), '20111203' );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        // Help panel - sidebar links
-        get_current_screen()->set_help_sidebar(
-                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
-                '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
-        );
-
</del><span class="cx">         // Handle spam/un-spam/delete of activities
</span><span class="cx">         if ( $doaction && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
</span><span class="cx">
</span><span class="lines">@@ -342,25 +385,55 @@
</span><span class="cx">                 // Store any error that occurs when updating the database item
</span><span class="cx">                 $error = 0;
</span><span class="cx">
</span><del>-                // Set tainted if a new form value is different from the object's old value
-                $tainted = false;
-                
</del><span class="cx">                 // Activity spam status
</span><ins>+                $prev_spam_status = $new_spam_status = false;
</ins><span class="cx">                 if ( ! empty( $_REQUEST['activity_status'] ) ) {
</span><span class="cx">                         $prev_spam_status = $activity->is_spam;
</span><del>-                        $new_spam_status = ( 'spam' == $_REQUEST['activity_status'] ) ? 1 : 0;
</del><ins>+                        $new_spam_status = ( 'spam' == $_REQUEST['activity_status'] ) ? true : false;
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Activity action
</span><del>-                if ( ! empty( $_REQUEST['bp-activities-action'] ) && stripslashes( $activity->action ) != stripslashes( $_REQUEST['bp-activities-action'] ) ) {
</del><ins>+                if ( ! empty( $_REQUEST['bp-activities-action'] ) )
</ins><span class="cx">                         $activity->action = $_REQUEST['bp-activities-action'];
</span><del>-                        $tainted = true;
-                }
</del><span class="cx">
</span><span class="cx">                 // Activity content
</span><del>-                if ( ! empty( $_REQUEST['bp-activities-content'] ) && stripslashes( $activity->content ) != stripslashes( $_REQUEST['bp-activities-content'] ) ) {
</del><ins>+                if ( ! empty( $_REQUEST['bp-activities-content'] ) )
</ins><span class="cx">                         $activity->content = $_REQUEST['bp-activities-content'];
</span><del>-                        $tainted = true;
</del><ins>+
+                // Activity primary link
+                if ( ! empty( $_REQUEST['bp-activities-link'] ) )
+                        $activity->primary_link = $_REQUEST['bp-activities-link'];
+
+                // Activity user ID
+                if ( ! empty( $_REQUEST['bp-activities-userid'] ) )
+                        $activity->user_id = (int) $_REQUEST['bp-activities-userid'];
+
+                // Activity item primary ID
+                if ( ! empty( $_REQUEST['bp-activities-primaryid'] ) )
+                        $activity->item_id = (int) $_REQUEST['bp-activities-primaryid'];
+
+                // Activity item secondary ID
+                if ( ! empty( $_REQUEST['bp-activities-secondaryid'] ) )
+                        $activity->secondary_item_id = (int) $_REQUEST['bp-activities-secondaryid'];
+
+                // Activity type
+                if ( ! empty( $_REQUEST['bp-activities-type'] ) ) {
+                        $actions = array();
+
+                        // Walk through the registered actions, and build an array of actions/values.
+                        foreach ( $bp->activity->actions as $action ) {
+                                $action = array_values( (array) $action );
+
+                                for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
+                                        $actions[] = $action[$i]['key'];
+                        }
+
+                        // This was a mis-named activity type from before BP 1.6
+                        unset( $actions['friends_register_activity_action'] );
+
+                        // Check that the new type is a registered activity type
+                        if ( in_array( $_REQUEST['bp-activities-type'], $actions ) )
+                                $activity->type = $_REQUEST['bp-activities-type'];
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Activity timestamp
</span><span class="lines">@@ -382,20 +455,15 @@
</span><span class="cx">                         // Reconstruct the date into a timestamp. Convert it to GMT.
</span><span class="cx">                         $gmt_date = get_gmt_from_date( sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss ) );
</span><span class="cx">
</span><del>-                        if ( $activity->date_recorded != $gmt_date ) {
-                                $activity->date_recorded = $gmt_date;
-                                $tainted = true;
-                        }
</del><ins>+                        $activity->date_recorded = $gmt_date;
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Has the spam status has changed?
</span><del>-                if ( $prev_spam_status != $new_spam_status ) {
-                        if ( 1 == $new_spam_status)
</del><ins>+                if ( $new_spam_status != $prev_spam_status ) {
+                        if ( $new_spam_status )
</ins><span class="cx">                                 bp_activity_mark_as_spam( $activity );
</span><span class="cx">                         else
</span><span class="cx">                                 bp_activity_mark_as_ham( $activity );
</span><del>-
-                        $tainted = true;
</del><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Save
</span><span class="lines">@@ -405,7 +473,7 @@
</span><span class="cx">                 wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
</span><span class="cx">
</span><span class="cx">                 // Check for any error during activity save
</span><del>-                if ( ! $result && $tainted )
</del><ins>+                if ( false === $result )
</ins><span class="cx">                         $error = $activity->id;
</span><span class="cx">
</span><span class="cx">                 // If an error occured, pass back the activity ID that failed
</span><span class="lines">@@ -447,9 +515,12 @@
</span><span class="cx"> /**
</span><span class="cx"> * Display the single activity edit screen
</span><span class="cx"> *
</span><ins>+ * @global int $screen_layout_columns Number of columns shown on this admin page
</ins><span class="cx"> * @since 1.6
</span><span class="cx"> */
</span><span class="cx"> function bp_activity_admin_edit() {
</span><ins>+        global $screen_layout_columns;
+
</ins><span class="cx">         // @todo: Check if user is allowed to edit activity items
</span><span class="cx">         // if ( ! current_user_can( 'bp_edit_activity' ) )
</span><span class="cx">         if ( ! is_super_admin() )
</span><span class="lines">@@ -485,7 +556,7 @@
</span><span class="cx">                 <?php if ( ! empty( $activity ) ) : ?>
</span><span class="cx">
</span><span class="cx">                         <form action="<?php echo esc_attr( $form_url ); ?>" id="bp-activities-edit-form" method="post">
</span><del>-                                <div id="poststuff" class="metabox-holder has-right-sidebar">
</del><ins>+                                <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
</ins><span class="cx">                                         <div id="side-info-column" class="inner-sidebar">
</span><span class="cx">                                                 <?php do_meta_boxes( 'toplevel_page_bp-activity', 'side', $activity ); ?>
</span><span class="cx">                                         </div>
</span><span class="lines">@@ -573,6 +644,95 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Primary link metabox for the Activity admin edit screen
+ *
+ * @param object $item Activity item
+ * @since 1.6
+ */
+function bp_activity_admin_edit_metabox_link( $item ) {
+?>
+
+        <label class="screen-reader-text" for="bp-activities-link"><?php _e( 'Link', 'buddypress' ); ?></label>
+        <input type="url" name="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" />
+        <p><?php _e( 'Activity generated by blog posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
+
+<?php
+}
+
+/**
+ * User ID metabox for the Activity admin edit screen
+ *
+ * @param object $item Activity item
+ * @since 1.6
+ */
+function bp_activity_admin_edit_metabox_userid( $item ) {
+?>
+
+        <label class="screen-reader-text" for="bp-activities-userid"><?php _e( 'Author ID', 'buddypress' ); ?></label>
+        <input type="number" name="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
+
+<?php
+}
+
+/**
+ * Activity type metabox for the Activity admin edit screen
+ *
+ * @global object $bp BuddyPress global settings
+ * @param object $item Activity item
+ * @since 1.6
+ */
+function bp_activity_admin_edit_metabox_type( $item ) {
+        global $bp;
+
+        $actions = array();
+        $selected = $item->type;
+
+        // Walk through the registered actions, and build an array of actions/values.
+        foreach ( $bp->activity->actions as $action ) {
+                $action = array_values( (array) $action );
+
+                for ( $i = 0, $i_count = count( $action ); $i < $i_count; $i++ )
+                        $actions[ $action[$i]['key'] ] = $action[$i]['value'];
+        }
+
+        // This was a mis-named activity type from before BP 1.6
+        unset( $actions['friends_register_activity_action'] );
+
+        // Sort array by the human-readable value
+        natsort( $actions );
+?>
+
+        <select name="bp-activities-type">
+                <?php foreach ( $actions as $k => $v ) : ?>
+                        <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
+                <?php endforeach; ?>
+        </select>
+
+<?php
+}
+
+/**
+ * Primary item ID/Secondary item ID metabox for the Activity admin edit screen
+ *
+ * @param object $item Activity item
+ * @since 1.6
+ */
+function bp_activity_admin_edit_metabox_itemids( $item ) {
+?>
+
+        <label for="bp-activities-primaryid"><?php _e( 'Primary Item ID', 'buddypress' ); ?></label>
+        <input type="number" name="bp-activities-primaryid" id="bp-activities-primaryid" value="<?php echo esc_attr( $item->item_id ); ?>" />
+        <br />
+
+        <label for="bp-activities-secondaryid"><?php _e( 'Secondary Item ID', 'buddypress' ); ?></label>
+        <input type="number" name="bp-activities-secondaryid" id="bp-activities-secondaryid" value="<?php echo esc_attr( $item->secondary_item_id ); ?>" />
+
+        <p><?php _e( 'These identify the object that created this activity. For example, the fields could reference a pair of site and comment IDs.', 'buddypress' ); ?></p>
+
+<?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">@@ -590,13 +750,13 @@
</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><del>-                $updated = !empty( $_REQUEST['updated'] ) ? (int) $_REQUEST['updated'] : 0;
</del><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="cx">
</span><span class="cx">                 if ( $error > 0 )
</span><del>-                        $messages[] = sprintf( __( 'An error occured when updating Activity ID #%s.', 'buddypress' ), number_format_i18n( $error ) );
</del><ins>+                        $messages[] = sprintf( __( 'An error occurred when updating Activity ID #%s.', 'buddypress' ), number_format_i18n( $error ) );
</ins><span class="cx">
</span><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' ), number_format_i18n( $spammed ) );
</span></span></pre></div>
<a id="trunkbpactivitybpactivityclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-classes.php (5483 => 5484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2011-12-10 18:16:23 UTC (rev 5483)
+++ trunk/bp-activity/bp-activity-classes.php        2011-12-10 18:19:44 UTC (rev 5484)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">                 else
</span><span class="cx">                         $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
</span><span class="cx">
</span><del>-                if ( !$wpdb->query( $q ) )
</del><ins>+                if ( false === $wpdb->query( $q ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 if ( empty( $this->id ) )
</span></span></pre>
</div>
</div>
</body>
</html>