Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#8304 closed enhancement (fixed)

Add `Delete Permanently` link to activity edit page

Reported by: oztaser's profile oztaser Owned by: slaffik's profile slaFFik
Milestone: 7.0.0 Priority: normal
Severity: normal Version: 1.6
Component: Administration Keywords: has-patch commit
Cc:

Description

There is a Delete Permanently link in the activities table and I think it will be useful if we add the same link to the activity edit page.

Attachments (4)

8304.patch (1.1 KB) - added by oztaser 4 years ago.
8304-2.patch (8.3 KB) - added by oztaser 4 years ago.
8304-2b.patch (871 bytes) - added by imath 4 years ago.
8304-3.patch (9.5 KB) - added by oztaser 4 years ago.

Download all attachments as: .zip

Change History (12)

@oztaser
4 years ago

#1 @imath
4 years ago

  • Component changed from Activity to Administration
  • Keywords has-patch reporter-feedback added
  • Milestone changed from Awaiting Review to 7.0.0
  • Owner set to slaFFik
  • Version set to 1.6

Hi @oztaser

Thanks a lot for your ticket and for your patch. I agree we should add this delete link to the activity edit page. But something bothers me: the javascript confirm as we are using a regular confirmation screen when deleting group or signup. I believe we should try to do the same thing everywhere : use a regular confirmation screen.

Here's the Group's delete confirmation screen: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-groups/bp-groups-admin.php#L688
Here's the Signup action confirmation screen: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-members/classes/class-bp-members-admin.php#L2147

Could you update your patch into this direction?

#2 @oztaser
4 years ago

  • Keywords reporter-feedback removed

Hi @imath,

Thanks for your suggestion. I am gonna work on it.

@oztaser
4 years ago

#3 @oztaser
4 years ago

Hi again @imath,

I've uploaded the new patch which use regular confirmation screen for activity delete. Can you review?

#4 @imath
4 years ago

Hi again @oztaser

After a quick look, it's looking pretty nice! I'll test the patch asap and will give you more advices (if needed)

@imath
4 years ago

#5 @imath
4 years ago

I've tested the patch and you're almost done. Great work!

1) Could you include 8304-2b.patch to your patch: it removes the javascript:confirm from the delete action of the Activity WP List Table that is no more necessary.

2) Instead of the content or the activity action, I think it would be better to use something like this for the bullet points of the confirmation page:
"Action/type" activity submitted by username on date with a link to the activity on the date. Eg:

3) finally, here are some minor improvements

// Add a space between ! and empty.
+	if ( ! empty( $doaction ) && ! in_array( $doaction, array( '-1', 'edit', 'save', 'delete', 'bulk_delete' ) ) ) {

// Use === instead of ==.
+	if ( 'edit' === $doaction && ! empty( $_GET['aid'] ) ) {
 		bp_activity_admin_edit();
+	}

// Add a full stop at the end of the comment.
+	// This is a request to delete single or multiple item.

// Use esc_html_e() instead of _e().
+		<h1><?php esc_html_e( 'Delete Activities', 'buddypress' ) ?></h1>
+		<p><?php esc_html_e( 'You are about to delete the following activities:', 'buddypress' ) ?></p>

+		<p><strong><?php esc_html_e( 'This action cannot be undone.', 'buddypress' ) ?></strong></p>

+		<a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php esc_html_e( 'Cancel', 'buddypress' ) ?></a>

+				<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>

Thanks again for your great work 👍

@oztaser
4 years ago

#6 @oztaser
4 years ago

1) Could you include 8304-2b.patch to your patch: it removes the javascript:confirm from the delete action of the Activity WP List Table that is no more necessary.

Nice catch, I added your update to my patch.

2) Instead of the content or the activity action, I think it would be better to use something like this for the bullet points of the confirmation page: "Action/type" activity submitted by username on date with a link to the activity on the date.

Thanks for the advice, I was not sure about this. Everything is clear now.

I've also updated the code style based on your suggestions. Thanks again for the review, I hope it's ready to commit.

#7 @imath
4 years ago

  • Keywords commit added

It is 99% ready :)

I've added some 'final touch' escaping functions as I've been tested it.

I will commit it asap. Thanks a lot for your great work about this improvement 💪

#8 @imath
4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 12659:

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

Note: See TracTickets for help on using tickets.