Skip to content

Conversation

@girishpanchal30
Copy link
Contributor

@girishpanchal30 girishpanchal30 commented Dec 30, 2025

Summary

Add a button Cleanup accounts to clean up the records and keep the last 1,000 records.

Screenshots

image image

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/tweet-old-post-pro/issues/431

@girishpanchal30 girishpanchal30 added the pr-checklist-skip Allow this Pull Request to skip checklist. label Dec 30, 2025
@pirate-bot pirate-bot added pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) pr-checklist-complete The Pull Request checklist is complete. (automatic label) and removed pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) labels Dec 30, 2025
@pirate-bot
Copy link
Contributor

pirate-bot commented Dec 30, 2025

Plugin build for c90f11a is ready 🛎️!

@stefan-cotitosu
Copy link

@girishpanchal30, could you please clarify on how to test this one?

I used a code snippet to add more than 1000 entries in the Sharing Logs and the Cleanup accounts button doesn't appear.

Below is the snippet I used:

add_action( 'init', function () {

    $option = 'rop_logs';

    $logs = get_option( $option, [] );

    // Safety: ensure it's an array
    if ( ! is_array( $logs ) ) {
        $logs = [];
    }

    $start = count( $logs );

    // Add dummy logs until we exceed 1000
    for ( $i = $start; $i < 1105; $i++ ) {
        $logs[] = [
            'time'    => time() + $i,
            'level'   => 'info',
            'message' => 'Dummy log entry #' . $i,
            'context' => 'test_cleanup',
        ];
    }

    update_option( $option, $logs, false );

    wp_die(
        'rop_logs now contains ' . count( $logs ) . ' entries. Remove this snippet.'
    );
});

rop-no-cleanup-btn

@Soare-Robert-Daniel
Copy link
Contributor

I used a code snippet to add more than 1000 entries in the Sharing Logs and the Cleanup accounts button doesn't appear.

I think this was a confusion. The implementation deletes the service accounts (twitter, Facebook) if they have more than 1000 registered. This should have been about the logs and not services.

Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issues should solve the problem with the logs and not services, based on the attached issue.

@girishpanchal30
Copy link
Contributor Author

Sorry for the confusion. I’ve implemented logic to delete the logs once they have more than 1,000 logs. Please check it and let me know if any changes are needed.

@rodica-andronache
Copy link

@girishpanchal30, from what I've tried, it's working well.

However, I get this warning
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants