public function removeExpiredOccasions()
    {
        global $wpdb;
        $date_limit = strtotime("midnight now") - 1;
        // Get all occasions from database
        $db_table = $wpdb->prefix."integrate_occasions";
        $occasions = $wpdb->get_results("SELECT * FROM $db_table ORDER BY start_date DESC", ARRAY_A);

        if (count($occasions) == 0) {
            return;
        }

        foreach ($occasions as $o) {
            // Delete the occasion if expired
            if (strtotime($o['end_date']) < $date_limit) {
                $id = $o['ID'];
                $wpdb->delete($db_table, array('ID' => $id));
            }
        }

        return;
    }
public function removeExpiredOccasions()
    {
        global $wpdb;
        $date_limit = strtotime("midnight now") - 1;
        // Get all occasions from database
        $db_table = $wpdb->prefix."integrate_occasions";
        $occasions = $wpdb->get_results("SELECT * FROM $db_table ORDER BY start_date DESC", ARRAY_A);

        if (count($occasions) == 0) {
            return;
        }

        foreach ($occasions as $o) {
            // Delete the occasion if expired
            if (strtotime($o['end_date']) < $date_limit) {
                $id = $o['ID'];
                $wpdb->delete($db_table, array('ID' => $id));
            }
        }

        return;
    }
public function removeExpiredOccasions ( ) { global $ wpdb ; $ date_limit = strtotime ( "midnight now" ) - 1 ; // Get all occasions from database $ db_table = $ wpdb -> prefix . "integrate_occasions" ; $ occasions = $ wpdb -> get_results ( "SELECT * FROM $db_table ORDER BY start_date DESC" , ARRAY_A ) ; if ( count ( $ occasions ) == 0 ) { return ; } foreach ( $ occasions as $ o ) { // Delete the occasion if expired if ( strtotime ( $ o [ 'end_date' ] ) < $ date_limit ) { $ id = $ o [ 'ID' ] ; $ wpdb -> delete ( $ db_table , array ( 'ID' => $ id ) ) ; } } return ; }
Remove expired occasions from databse
@return void
Remove expired occasions from databse