Help with gamipress logs
-
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
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Help with gamipress logs’ is closed to new replies.