Advertisement
verygoodplugins

Untitled

Sep 21st, 2020
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. function edd_sl_check_for_expired_licenses() {
  2.  
  3.     $args = array(
  4.         'number'     => -1,
  5.         'parent'     => 0, // Child keys get expired during set_license_status()
  6.         'expiration' => array(
  7.             'start' => strtotime( '-1 Month' ),
  8.             'end'   => current_time( 'timestamp' ),
  9.         ),
  10.         'status' => array( 'active', 'inactive', 'disabled' ),
  11.     );
  12.  
  13.     $args      = apply_filters( 'edd_sl_expired_licenses_args', $args );
  14.     $licenses  = edd_software_licensing()->licenses_db->get_licenses( $args );
  15.  
  16.     if( ! $licenses ) {
  17.         return; // no expiring keys found
  18.     }
  19.  
  20.     foreach( $licenses as $license ) {
  21.         $license->status = 'expired';
  22.     }
  23. }
  24. add_action( 'edd_daily_scheduled_events', 'edd_sl_check_for_expired_licenses' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement