Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Created October 5, 2012 05:46
Show Gist options
  • Save thenbrent/3838301 to your computer and use it in GitHub Desktop.
Save thenbrent/3838301 to your computer and use it in GitHub Desktop.
Subscription scheduled payment & cron lock logger
<?php
$subscription_keys = array( '285_139', '304_108' );
foreach ( $subscription_keys as $subscription_key ) {
$user_id = 2;
error_log('----');
$transient_timeout = get_option( '_transient_timeout_wcs_blocker_' . $user_id . '_' . $subscription_key );
$time_diff = abs( time() - $transient_timeout ) / 60 / 60;
error_log( $subscription_key . ' transient_timeout in ' . $time_diff . ' hours');
$next_scheduled_payment = wp_next_scheduled( 'scheduled_subscription_payment', array( 'user_id' => $user_id, 'subscription_key' => $subscription_key ) );
$time_diff = abs( time() - $next_scheduled_payment ) / 60 / 60;
error_log( $subscription_key . ' scheduled_subscription_payment in ' . $time_diff . ' hours');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment