<!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][12659] trunk/src/bp-activity: Activity Admin: improve the delete activity actions</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 { white-space: pre-line; 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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12659">12659</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12659","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-05-24 20:32:03 +0000 (Sun, 24 May 2020)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Activity Admin: improve the delete activity actions

- Add a new delete link to the activity edit screen.
- Add a confirmation screen before deleting activity to be consistent with how items are deleted into the Groups Admin screen and the Signups Admin screen.
- Update the existing delete links so that they use the confirmation screen link.
- Improve code formatting/output escaping.

Props oztaser

Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8304">#8304</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpactivityadmincssadminrtlcss">trunk/src/bp-activity/admin/css/admin-rtl.css</a></li>
<li><a href="#trunksrcbpactivityadmincssadmincss">trunk/src/bp-activity/admin/css/admin.css</a></li>
<li><a href="#trunksrcbpactivitybpactivityadminphp">trunk/src/bp-activity/bp-activity-admin.php</a></li>
<li><a href="#trunksrcbpactivityclassesclassbpactivitylisttablephp">trunk/src/bp-activity/classes/class-bp-activity-list-table.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpactivityadmincssadminrtlcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/admin/css/admin-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/admin/css/admin-rtl.css     2020-05-17 10:00:24 UTC (rev 12658)
+++ trunk/src/bp-activity/admin/css/admin-rtl.css       2020-05-24 20:32:03 UTC (rev 12659)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,6 +97,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        width: 12%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ul.bp-activity-delete-list {
+       list-style-type: disc;
+       margin: 4px 26px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> @media screen and (max-width: 782px) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
</span></span></pre></div>
<a id="trunksrcbpactivityadmincssadmincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/admin/css/admin.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/admin/css/admin.css 2020-05-17 10:00:24 UTC (rev 12658)
+++ trunk/src/bp-activity/admin/css/admin.css   2020-05-24 20:32:03 UTC (rev 12659)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,6 +97,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        width: 12%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ul.bp-activity-delete-list {
+       list-style-type: disc;
+       margin: 4px 26px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> @media screen and (max-width: 782px) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
</span></span></pre></div>
<a id="trunksrcbpactivitybpactivityadminphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/bp-activity-admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/bp-activity-admin.php       2020-05-17 10:00:24 UTC (rev 12658)
+++ trunk/src/bp-activity/bp-activity-admin.php 2020-05-24 20:32:03 UTC (rev 12659)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -323,7 +323,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        do_action( 'bp_activity_admin_enqueue_scripts' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Handle spam/un-spam/delete of activities.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( !empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', 'delete', 'bulk_delete' ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Build redirection URL.
</span><span class="cx" style="display: block; padding: 0 10px">                $redirect_to = remove_query_arg( array( 'aid', 'deleted', 'error', 'spammed', 'unspammed', ), wp_get_referer() );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -330,7 +330,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Get activity IDs.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $activity_ids = wp_parse_id_list( $_REQUEST['aid'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters list of IDs being spammed/un-spammed/deleted.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -349,7 +349,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        // Trim 'bulk_' off the action name to avoid duplicating a ton of code.
</span><span class="cx" style="display: block; padding: 0 10px">                        $doaction = substr( $doaction, 5 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // This is a request to delete, spam, or un-spam, a single item.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // This is a request to delete single or multiple item.
+               } elseif ( 'do_delete'  === $doaction && ! empty( $_REQUEST['aid'] ) ) {
+                       check_admin_referer( 'bp-activities-delete' );
+
+               // This is a request to spam, or un-spam, a single item.
</ins><span class="cx" style="display: block; padding: 0 10px">                 } elseif ( !empty( $_REQUEST['aid'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Check this is a valid form submission.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -375,13 +379,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        switch ( $doaction ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                case 'delete' :
-                                       if ( 'activity_comment' == $activity->type )
-                                               bp_activity_delete_comment( $activity->item_id, $activity->id );
-                                       else
-                                               bp_activity_delete( array( 'id' => $activity->id ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         case 'do_delete' :
+                                       if ( 'activity_comment' === $activity->type ) {
+                                               $delete_result = bp_activity_delete_comment( $activity->item_id, $activity->id );
+                                       } else {
+                                               $delete_result = bp_activity_delete( array( 'id' => $activity->id ) );
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $deleted++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! $delete_result ) {
+                                               $errors[] = $activity->id;
+                                       } else {
+                                               $deleted++;
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                                         break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                case 'ham' :
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -396,10 +405,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $result = $activity->save();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        // Check for any error during activity save.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( ! $result )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! $result ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $errors[] = $activity->id;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        else
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $unspammed++;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        }
</ins><span class="cx" style="display: block; padding: 0 10px">                                         break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                case 'spam' :
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -407,10 +417,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $result = $activity->save();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        // Check for any error during activity save.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        if ( ! $result )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( ! $result ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $errors[] = $activity->id;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        else
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 $spammed++;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        }
</ins><span class="cx" style="display: block; padding: 0 10px">                                         break;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                default:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -435,18 +446,22 @@
</span><span class="cx" style="display: block; padding: 0 10px">                do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $spammed )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $spammed ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $unspammed )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $unspammed ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $deleted )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $deleted ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // If an error occurred, pass back the activity ID that failed.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! empty( $errors ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! empty( $errors ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $redirect_to = add_query_arg( 'error', implode ( ',', array_map( 'absint', $errors ) ), $redirect_to );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters redirect URL after activity spamming/un-spamming/deletion occurs.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -604,18 +619,99 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_activity_admin() {
</span><span class="cx" style="display: block; padding: 0 10px">        // Decide whether to load the index or edit screen.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $doaction = bp_admin_list_table_current_bulk_action();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // Display the single activity edit screen.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( 'edit' == $doaction && ! empty( $_GET['aid'] ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'edit' === $doaction && ! empty( $_GET['aid'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 bp_activity_admin_edit();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        // Display the activty delete confirmation screen.
+       } elseif ( in_array( $doaction, array( 'bulk_delete', 'delete' ) ) && ! empty( $_GET['aid'] ) ) {
+               bp_activity_admin_delete();
+
</ins><span class="cx" style="display: block; padding: 0 10px">         // Otherwise, display the Activity index screen.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        else
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                 bp_activity_admin_index();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Display the Activity delete confirmation screen.
+ *
+ * @since 7.0.0
+ */
+function bp_activity_admin_delete() {
+
+       if ( ! bp_current_user_can( 'bp_moderate' ) ) {
+               die( '-1' );
+       }
+
+       $activity_ids = isset( $_REQUEST['aid'] ) ? $_REQUEST['aid'] : 0;
+
+       if ( ! is_array( $activity_ids ) ) {
+               $activity_ids = explode( ',', $activity_ids );
+       }
+
+       $activities = bp_activity_get( array(
+               'in'               => $activity_ids,
+               'show_hidden'      => true,
+               'spam'             => 'all',
+               'display_comments' => 0,
+               'per_page'         => null
+       ) );
+
+       // Create a new list of activity ids, based on those that actually exist.
+       $aids = array();
+       foreach ( $activities['activities'] as $activity ) {
+               $aids[] = $activity->id;
+       }
+
+       $base_url = remove_query_arg( array( 'action', 'action2', 'paged', 's', '_wpnonce', 'aid' ), $_SERVER['REQUEST_URI'] ); ?>
+
+       <div class="wrap">
+               <h1><?php esc_html_e( 'Delete Activities', 'buddypress' ) ?></h1>
+               <p><?php esc_html_e( 'You are about to delete the following activities:', 'buddypress' ) ?></p>
+
+               <ul class="bp-activity-delete-list">
+               <?php foreach ( $activities['activities'] as $activity ) : ?>
+                       <li>
+                       <?php
+                       $actions = bp_activity_admin_get_activity_actions();
+
+                       if ( isset( $actions[ $activity->type ] ) ) {
+                               $activity_type =  $actions[ $activity->type ];
+                       } else {
+                               /* translators: %s: the name of the activity type */
+                               $activity_type = sprintf( __( 'Unregistered action - %s', 'buddypress' ), $activity->type );
+                       }
+
+                       printf(
+                               /* translators: 1: activity type. 2: activity author. 3: activity date and time. */
+                               __( '"%1$s" activity submitted by %2$s on %3$s', 'buddypress' ),
+                               esc_html( $activity_type ),
+                               bp_core_get_userlink( $activity->user_id ),
+                               sprintf(
+                                       '<a href="%1$s">%2$s</a>',
+                                       esc_url( bp_activity_get_permalink( $activity->id, $activity ) ),
+                                       date_i18n( bp_get_option( 'date_format' ), strtotime( $activity->date_recorded ) )
+                               )
+                       );
+                       ?>
+                       </li>
+               <?php endforeach; ?>
+               </ul>
+
+               <p><strong><?php esc_html_e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>
+
+               <a class="button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'aid' => implode( ',', $aids ) ), $base_url ), 'bp-activities-delete' ) ); ?>"><?php esc_html_e( 'Delete Permanently', 'buddypress' ) ?></a>
+               <a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php esc_html_e( 'Cancel', 'buddypress' ) ?></a>
+       </div>
+
+       <?php
+}
+
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Display the single activity edit screen.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 1.6.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -741,6 +837,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @param object $item Activity item.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_activity_admin_edit_metabox_status( $item ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $base_url = add_query_arg( array(
+               'page' => 'bp-activity',
+               'aid'  => $item->id
+       ), bp_get_admin_url( 'admin.php' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="submitbox" id="submitcomment">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -783,6 +883,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                </div><!-- #minor-publishing -->
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                <div id="major-publishing-actions">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        <div id="delete-action">
+                               <a class="submitdelete deletion" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'action', 'delete', $base_url ), 'bp-activities-delete' ) ); ?>"><?php esc_html_e( 'Delete Permanently', 'buddypress' ) ?></a>
+                       </div>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         <div id="publishing-action">
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php submit_button( __( 'Update', 'buddypress' ), 'primary', 'save', false ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        </div>
</span></span></pre></div>
<a id="trunksrcbpactivityclassesclassbpactivitylisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/classes/class-bp-activity-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/classes/class-bp-activity-list-table.php    2020-05-17 10:00:24 UTC (rev 12658)
+++ trunk/src/bp-activity/classes/class-bp-activity-list-table.php      2020-05-24 20:32:03 UTC (rev 12659)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -648,23 +648,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Reply - JavaScript only; implemented by AJAX.
</span><span class="cx" style="display: block; padding: 0 10px">                if ( 'spam' != $item_status ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( $this->can_comment( $item ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', esc_html__( 'Reply', 'buddypress' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $actions['reply'] = sprintf( '<span class="form-input-tip">%s</span>', __( 'Replies disabled', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $actions['reply'] = sprintf( '<span class="form-input-tip">%s</span>', esc_html__( 'Replies disabled', 'buddypress' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Edit.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $actions['edit'] = sprintf( '<a href="%s">%s</a>', esc_url( $edit_url ), esc_html__( 'Edit', 'buddypress' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Spam/unspam.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( 'spam' == $item_status )
-                       $actions['unspam'] = sprintf( '<a href="%s">%s</a>', $ham_url, __( 'Not Spam', 'buddypress' ) );
-               else
-                       $actions['spam'] = sprintf( '<a href="%s">%s</a>', $spam_url, __( 'Spam', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( 'spam' == $item_status ) {
+                       $actions['unspam'] = sprintf( '<a href="%s">%s</a>', esc_url( $ham_url ), esc_html__( 'Not Spam', 'buddypress' ) );
+               } else {
+                       $actions['spam'] = sprintf( '<a href="%s">%s</a>', esc_url( $spam_url ), esc_html__( 'Spam', 'buddypress' ) );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Delete.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $actions['delete'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $delete_url ), esc_html__( 'Delete Permanently', 'buddypress' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Start timestamp.
</span><span class="cx" style="display: block; padding: 0 10px">                echo '<div class="submitted-on">';
</span></span></pre>
</div>
</div>

</body>
</html>