Help with gamipress logs | WordPress.org

[ad_1]

Hello,

Please can you help confirm if this code are correct and safe to use

// Schedule event to clean gamipress logs every 7 days
if ( ! wp_next_scheduled( 'gamipress_clean_logs' ) ) {
    wp_schedule_event( time(), 'daily', 'gamipress_clean_logs' );
}

// Gamipress action to perform log cleaning
function gamipress_clean_logs_daily() {
    gamipress_clean_logs( 7 );
}
add_action( 'gamipress_clean_logs', 'gamipress_clean_logs_daily' );

And

// Schedule event to clean user earnings logs every 7 days
if ( ! wp_next_scheduled( 'gamipress_clean_user_earnings_logs' ) ) {
    wp_schedule_event( time(), 'daily', 'gamipress_clean_user_earnings_logs' );
}

// Action to perform user earnings log cleaning
function clean_gamipress_user_earnings_logs_daily() {
    global $wpdb;
    $table_name = $wpdb->prefix . 'gamipress_user_earnings';
    $wpdb->query( "DELETE FROM $table_name WHERE date < DATE_SUB( NOW(), INTERVAL 7 DAY )" );
}
add_action( 'gamipress_clean_user_earnings_logs', 'clean_gamipress_user_earnings_logs_daily()' );

Thanks

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer