verygoodplugins

Untitled

Sep 21st, 2020
730
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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' );
RAW Paste Data