• Resolved anpimartinez

    (@anpimartinez)


    I love the simplicity of the plugin, thank you very much for developing.
    I just have a question, how can I delete the records from the area: Activity Log?

    I don’t want my database to be saturated with so much information

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @anpimartinez,

    By default, the activity log expires after 12 days. If you wish to reduce that period, you can set a custom log lifetime ( in days ), using the following filter we have provided for that purpose.

    add_filter( 'sgs_set_activity_log_lifetime', 'set_custom_log_lifetime' );
    function set_custom_log_lifetime() {
        return 'your-custom-log-lifetime-in-days';
    }

    Kind regards,
    Stoyan

    Thread Starter anpimartinez

    (@anpimartinez)

    Hi Stoyan. I have to change some value of the code that you share with me? Or do I just paste it like this in my plugin functions?

    Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @anpimartinez,

    You would have to change it to the period you would like. For example, if you wish to set the period to 5 days you would have to set it like this:

    add_filter( 'sgs_set_activity_log_lifetime', 'set_custom_log_lifetime' );
    function set_custom_log_lifetime() {
        return '5';
    }

    Kind regards,
    Stoyan

    Thread Starter anpimartinez

    (@anpimartinez)

    I already added it to the code snippets plugin but it doesn’t work, I left it so that the records will be deleted after 1 day, but nothing is deleted.

    Attached capture: https://prntscr.com/1ip176i

    Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @anpimartinez,

    The code should be working the way you’ve set it and the logs should be deleted. Could you provide more details on where you have set the code? It should be added to the functions.php.

    Kind regards,
    Stoyan

    Thread Starter anpimartinez

    (@anpimartinez)

    Stoyan, you were absolutely right the code works correctly.
    My problem was that I did not have the Cron enabled, but now that it is active the code works as you say …

    Again, thank you very much.

    Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hey there @anpimartinez,

    I am really glad that it worked!

    We would really appreciate it if you spend some time leaving a review and rate our plugin. This will help us a lot.

    Kind regards,
    Stoyan

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Delete records from [Activity Log]’ is closed to new replies.