• Sambuno

    (@goldmaverick)


    Please add delete [ALL SPAM & ALL TRASH] function. It is impossible to go about this one by one. Please

Viewing 7 replies - 1 through 7 (of 7 total)
  • I totally agree. Having to move spam messages — 20 at a time — to the trash before being able to delete them is maddening.

    Thanks in advance for your attention to this important request.

    There appears to already be a “Empty Trash” button above the messages list if your user can flamingo_delete_inbound_messages.

    +1 on adding the bulk spam delete operation, for sure, though!

    Also, not to hijack this topic, I have an odd request from a client… but why is the Export option not also available on the Spam/Trash views? It’s possible that someone might want to do a bulk export of these just as well (so they can have as a cold archive / search that spreadsheet export just in case while the site is then able to be cleaned up of those messages without worry of losing past data). It’s a separate request from this topic, but it’s somewhat related, in a way, so I wanted to mention it.

    Edit: I’ve found a solution to my separate issue and I’ve posted the details here: https://www.ads-software.com/support/topic/proposed-update-allow-exporting-of-trash-and-spam/. I would still love to see an “Empty Spam” function added as this topic requested (and also have my patch for universal export support be officially adopted).

    • This reply was modified 5 years, 3 months ago by KZeni. Reason: Added mention of the existing Empty Trash button
    • This reply was modified 5 years, 3 months ago by KZeni. Reason: Added snippet about how I found a solution to my issue & have posted about it in its own separate topic

    I would imagine it would be fairly straightforward to find how the Empty Trash button is currently implemented and what it’s currently doing, and then recreate that as needed for a new Empty Spam button & its necessary functionality.

    Here’s my untested patch for accommodating this.

    Edit admin/includes/class-inbound-messages-list-table.php so that:

    
    if ( $this->is_trash
    and current_user_can( 'flamingo_delete_inbound_messages' ) ) {
    	submit_button( __( 'Empty Trash', 'flamingo' ),
    		'button-secondary apply', 'delete_all', false );
    }
    

    is now (simply add a new snippet for spam alongside the unchanged trash-specific code):

    
    if ( $this->is_trash
    and current_user_can( 'flamingo_delete_inbound_messages' ) ) {
    	submit_button( __( 'Empty Trash', 'flamingo' ),
    		'button-secondary apply', 'delete_all', false );
    }
    
    if ( $this->is_spam
    and current_user_can( 'flamingo_delete_inbound_messages' ) ) {
    	submit_button( __( 'Empty Spam', 'flamingo' ),
    		'button-secondary apply', 'delete_spam', false );
    }
    

    Edit admin/admin-functions.php so that:

    
    if ( isset( $_REQUEST['delete_all'] )
    || isset( $_REQUEST['delete_all2'] ) ) {
    	return 'delete_all';
    }
    

    is now (again, simply add a new snippet for spam alongside the unchanged trash-specific code):

    
    if ( isset( $_REQUEST['delete_all'] )
    || isset( $_REQUEST['delete_all2'] ) ) {
    	return 'delete_all';
    }
    
    if ( isset( $_REQUEST['delete_spam'] ) ) {
    	return 'delete_spam';
    }
    

    and then add this after the flamingo_get_all_ids_in_trash function in that same file:

    
    function flamingo_get_all_ids_in_spam( $post_type ) {
    	global $wpdb;
    
    	$q = "SELECT ID FROM $wpdb->posts WHERE post_status = 'spam'"
    		. $wpdb->prepare( " AND post_type = %s", $post_type );
    
    	return $wpdb->get_col( $q );
    }
    

    Edit admin/admin.php so that:

    
    if ( 'delete_all' == $action ) {
    	check_admin_referer( 'bulk-posts' );
    	$_REQUEST['post'] = flamingo_get_all_ids_in_trash(
    		Flamingo_Inbound_Message::post_type );
    	$action = 'delete';
    }
    

    is now (again, simply add a new snippet for spam alongside the unchanged trash-specific code):

    
    if ( 'delete_all' == $action ) {
    	check_admin_referer( 'bulk-posts' );
    	$_REQUEST['post'] = flamingo_get_all_ids_in_trash(
    		Flamingo_Inbound_Message::post_type );
    	$action = 'delete';
    }
    
    if ( 'delete_spam' == $action ) {
    	check_admin_referer( 'bulk-posts' );
    	$_REQUEST['post'] = flamingo_get_all_ids_in_spam(
    		Flamingo_Inbound_Message::post_type );
    	$action = 'delete';
    }
    

    That should take care of replicating the Empty Trash button & functionality while editing things as needed to make it then apply to Empty Spam.

    This code is untested as of yet so I wouldn’t use it without making a backup first. I’d love to hear if it worked well, though. Since it might be ready to propose being implemented officially in the plugin by the plugin developer.

    Colin

    (@colinsafranek)

    +1 Please add a “delete all spam” button.

    But ALSO please add the ability to view more than 20 message records at a time. This functionality is built in to wordpress post types and can be configured in the “screen options” tab in the upper right corner of the WP Admin. While viewing the Flamingo inbound messages, you can currently use the “screen options” tab to configure the pagination settings (posts per page), but upon saving this option nothing changes, there are still only 20 messages per page.

    It would be awesome to be able to view, and therefore bulk edit, more than 20 per page.

    Cheers!

    @colinsafranek It seems you might’ve overlooked something or you might need to clear your server-side and/or browser cache. This does use a custom post type for the messages, pagination option is shown under “screen options”, and I’ve set it to 100 with it correctly showing 100 items on the listing. This works for both the Inbox as well as Spam (see https://cloudup.com/c4tp5mMVYiM and https://cloudup.com/cuhRaWmjHeG [didn’t include the list for privacy reasons, but I can guarantee that it’s listing 100 messages per page for both.]) Again, I’d chalk this up to maybe being caching related (on the server, your browser, or both) that’s then preventing that setting from displaying the updated results after changing it.

    +1 for the @kzeni solution

    @kzeni – The Screen option was for sure a game changer for me. Set pagination to max 400 before it started seizing up, and started deleting them all. I got slammed at one point in time, but now the messages are like 20 a day. Only 7k more to go!

    I don’t know why people SPAM instead of making good, fresh content that helps people.

    • This reply was modified 5 years, 1 month ago by Tangeray.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Please add delete [ALL SPAM & ALL TRASH] function’ is closed to new replies.