Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/24/2020 08:32:03 PM (6 years ago)
Author:
imath
Message:

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 #8304

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/classes/class-bp-activity-list-table.php

    r12586 r12659  
    649649        if ( 'spam' != $item_status ) {
    650650            if ( $this->can_comment( $item ) ) {
    651                 $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
     651                $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', esc_html__( 'Reply', 'buddypress' ) );
    652652            } else {
    653                 $actions['reply'] = sprintf( '<span class="form-input-tip">%s</span>', __( 'Replies disabled', 'buddypress' ) );
     653                $actions['reply'] = sprintf( '<span class="form-input-tip">%s</span>', esc_html__( 'Replies disabled', 'buddypress' ) );
    654654            }
    655655
    656656            // Edit.
    657             $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
     657            $actions['edit'] = sprintf( '<a href="%s">%s</a>', esc_url( $edit_url ), esc_html__( 'Edit', 'buddypress' ) );
    658658        }
    659659
    660660        // Spam/unspam.
    661         if ( 'spam' == $item_status )
    662             $actions['unspam'] = sprintf( '<a href="%s">%s</a>', $ham_url, __( 'Not Spam', 'buddypress' ) );
    663         else
    664             $actions['spam'] = sprintf( '<a href="%s">%s</a>', $spam_url, __( 'Spam', 'buddypress' ) );
     661        if ( 'spam' == $item_status ) {
     662            $actions['unspam'] = sprintf( '<a href="%s">%s</a>', esc_url( $ham_url ), esc_html__( 'Not Spam', 'buddypress' ) );
     663        } else {
     664            $actions['spam'] = sprintf( '<a href="%s">%s</a>', esc_url( $spam_url ), esc_html__( 'Spam', 'buddypress' ) );
     665        }
    665666
    666667        // Delete.
    667         $actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );
     668        $actions['delete'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $delete_url ), esc_html__( 'Delete Permanently', 'buddypress' ) );
    668669
    669670        // Start timestamp.
Note: See TracChangeset for help on using the changeset viewer.