Exemple #1
0
 /**
  * Do the scheduler
  */
 function do_cron()
 {
     $maybe_expire_users = Expire_Users_Query::query(array('expired' => false, 'expired_date' => current_time('timestamp'), 'expired_date_compare' => '<'));
     if ($maybe_expire_users->results > 0) {
         foreach ($maybe_expire_users->results as $expired_user) {
             $this_expire_user = new Expire_User($expired_user->ID);
             $this_expire_user->expire();
         }
     }
 }
 /**
  * Expire User Now
  */
 public function expire_user_now()
 {
     // Verify nonce
     if (isset($_GET['expire_users_nonce']) && wp_verify_nonce($_GET['expire_users_nonce'], 'expire-user-now')) {
         if (isset($_GET['expire-user'])) {
             // Expire user now
             $user = new Expire_User(absint($_GET['expire-user']));
             $user->set_expire_timestamp(current_time('timestamp'));
             $user->save_user();
             $user->expire();
         }
         wp_safe_redirect(remove_query_arg(array('expire-user', 'expire_users_nonce')));
     }
 }