Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Hide past events#688

It’s great, that events show for the rest of the day the event happened but they should dissapear the next day without them having to be deleted. When deleting (canceling) a past event, past customers still receive cancelation emails which doesn’t make much sense. There should be an option to hide past events and a way to delete past events without cancelation emails being sent.

4 years ago
1

I totally agree with you! Has there been any cahnges been made to this topic. I just looks very unprofessional to see all the past events still appearing.

4 years ago
3
?

Also need this feature

4 years ago
1

Unfortunately, no changes have been made to the topic. I brought it up three updates ago, checked in with the team again one update ago, they told me the devs would prioritize it but nothing has happened. I am already looking for another event booking solution because this is a mess. My guests frequently try to book for past events and ask me why registration is closed. I understand that events are not Amelias priority but Amelia would be fantastic for events, if these small issues are solved. There should be a way to hide past events without deleting them and one to delete them without sending a cancelation email to all the guests. There are some other issues but these are a real problem. You couldn’t even delete events from months ago without informing every single guest that the event is canceled. What should also be possible is hiding the registered guest count and only showing remaining ticket count when it’s below a certain threshold. Anyway. I hope this gets fixed because I would really like to keep using Amelia. Overall it’s a fantastic plugin.

4 years ago
G

I agree, this feature is important. Meanwhile a workaround for deleting/canceling past events without emailing past attendees is to go to the notifications manu and switch off temporarily the cancelation notifications (tick box).

3 years ago
1
A

I also need this feature, thanks for the discripton of the workaround

3 years ago
?

It would also be great to be able to hide cancelled events from the main event listings!

3 years ago

Still no update.

3 years ago

I think it is possible. I am not a developer but have used the API with ChatGPT and Google App Script to create some Google Sheets automation. That works very well. I just checked the API documentation and believe that the Update Events API endpoint could make it possible to update the event tags everytime an event ends.

2 years ago
U

There is a way around hiding closed events automatically using a PHP code through a snippet plugin, then activating the code to work on the entire website or specific page(s) you want. The PHP code is pasted below:

<?php

// Hook into the Amelia Events filter
add_filter( ‘amelia_events_query_args’, ‘hide_closed_events_from_frontend’ );

function hide_closed_events_from_frontend( $args ) {

// Check if the current page is the frontend (you might need to adjust this based on your theme)
if ( is_front_page() || is_home() || is_singular() ) { 
    // Modify the query to exclude events with the status 'closed'
    $args['meta_query'][] = array(
        'key'     => 'status',
        'value'   => 'closed',
        'compare' => '!=' 
    );
}

return $args;

}

?>

I just wanted to say that I hope this works for you. Enjoy!!!

a year ago

Thank you so much for this. I will try it. Would still love for the Amelia team to provide and actual solution but if your code works, it would be amazing. Thank you so much for sharing!

a year ago

Hi I tried the above PHP snippet but unfortunately couldnt get it to work for my build. I added this CSS Snippet instead and it hides the courses from front end. I added in Custom CSS sitewide but it work on page css also. Its not ideal but it works.

CSS Snippet Here:

/START Hide Closed Events from Amelia Booking front end/
.am-ec:has(p.am-ec__info-availability.closed) { display: none!important; }
/END Hide Closed Events from Amelia Booking front end/

Hope it helps someone.

a year ago
S

It is absurd that we haven’t been able to get this feature in 4+ years. I’ve talked to support multiple times who endless promise it, but nothing happens. This is an essential feature for creating clean, navigatable event lists. We’ve tried multiple hack work arounds but they are not reliable given that they conflict with Amelia pagination, etc.

6 months ago

Yea, I am also still waiting. And hoping. They are at least reduced opacity since the event list 2.0 was released. That’s better than before because before people had to read the label and we had bookings made in error for the previous week everyday. That doesn’t happen that much anymore but it would still be great and probably make sense for most people to completely hide past events. They are not relevant anymore.

6 months ago
G

<?php
/**

  • Plugin Name: Amelia - Hide Past Events (Cron)
  • Description: Blendet abgelaufene Amelia Events automatisch aus der Frontend-Liste aus (setzt “show” auf 0).
  • Author: Your Team
    */

if (!defined(‘ABSPATH’)) exit;

class Amelia_Hide_Past_Events_Cron {

const HOOK = 'amelia_hide_past_events_cron';
const OPTION_LAST_RUN = 'amelia_hide_past_events_last_run';

const GRACE_MINUTES = 0;

public static function init() {
    add_action('init', [__CLASS__, 'schedule']);
    add_action(self::HOOK, [__CLASS__, 'run']);
}

public static function schedule() {
    if (!wp_next_scheduled(self::HOOK)) {
        wp_schedule_event(time() + 60, 'hourly', self::HOOK);
    }
}

public static function run() {
    global $wpdb;

    $events_table = $wpdb->prefix . 'amelia_events';
    $periods_table = $wpdb->prefix . 'amelia_events_periods';

    if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $events_table)) !== $events_table) {
        return;
    }

    $now = current_time('mysql'); // "YYYY-mm-dd HH:ii:ss"
    if (self::GRACE_MINUTES > 0) {
        $now_ts = strtotime($now) - (self::GRACE_MINUTES * 60);
        $cutoff = date('Y-m-d H:i:s', $now_ts);
    } else {
        $cutoff = $now;
    }

    $updated = 0;

    if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $periods_table)) === $periods_table) {


        $sql = "
            UPDATE {$events_table} e
            INNER JOIN (
                SELECT eventId, MAX(periodEnd) AS lastEnd
                FROM {$periods_table}
                GROUP BY eventId
            ) p ON p.eventId = e.id
            SET e.show = 0
            WHERE e.show = 1
              AND p.lastEnd < %s
        ";

        $updated = (int) $wpdb->query($wpdb->prepare($sql, $cutoff));

    } else {
        $columns = $wpdb->get_col("DESCRIBE {$events_table}", 0);
        $end_col = null;

        foreach (['endDate', 'periodEnd', 'end_date', 'end', 'dateEnd'] as $candidate) {
            if (in_array($candidate, $columns, true)) { $end_col = $candidate; break; }
        }

        if ($end_col) {
            $sql = "
                UPDATE {$events_table}
                SET show = 0
                WHERE show = 1
                  AND {$end_col} < %s
            ";
            $updated = (int) $wpdb->query($wpdb->prepare($sql, $cutoff));
        }
    }

    update_option(self::OPTION_LAST_RUN, [
        'time'    => current_time('mysql'),
        'cutoff'  => $cutoff,
        'updated' => $updated,
    ], false);
}

}

Amelia_Hide_Past_Events_Cron::init();

/**

  • This plugin automatically hides past Amelia events from the frontend event list.
    *
  • How it works:
  • – On WordPress initialization, a cron job is registered and executed once per hour.
  • – The cron job checks all Amelia events that are currently marked as visible (show = 1).
  • – For each event, the latest end date is determined:
  • – Primarily via the amelia_events_periods table using MAX(periodEnd) per event,
  • – Alternatively via an available end-date column in the events table,
  • if the periods table does not exist.
  • – If the determined end date is in the past (optionally adjusted by a configurable
  • grace period in minutes), the event is automatically hidden
  • by setting the show field to 0.
  • – No data is deleted; events remain stored in the database.
  • – After each run, the execution time, the cutoff timestamp, and the number
  • of updated events are saved in the option amelia_hide_past_events_last_run.
    *
  • Purpose:
  • – Ensure that expired Amelia events no longer appear on the frontend
  • without requiring manual backend maintenance.
    */
6 months ago
Merged into More options for [ameliaevents]#1403
4 months ago