Files
roi-theme/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/crons.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

49 lines
1.1 KiB
PHP
Executable File

<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
add_action( 'init', 'thrive_maybe_schedule_token_cron' );
function thrive_maybe_schedule_token_cron() {
/**
* Schedule token cron
*/
if ( ! wp_get_schedule( 'thrive_token_cron' ) ) {
wp_schedule_event( time(), 'daily', 'thrive_token_cron' );
}
}
add_action( 'thrive_token_cron', 'thrive_execute_token_job' );
/**
* Delete token option and thrive admin user when it reaches expiration date
*/
function thrive_execute_token_job() {
$saved_token = get_option( 'thrive_token_support' );
if ( isset( $saved_token['valid_until'] ) && $saved_token['valid_until'] ) {
$valid_until = strtotime( $saved_token['valid_until'] );
if ( time() >= $valid_until ) {
/**
* Delete current token option
*/
delete_option( 'thrive_token_support' );
/* delete the generated initial token */
delete_option( 'tve_dash_generated_token' );
/**
* Delete thrive user
*/
tve_dash_delete_support_user();
}
}
}