Support

Home Forums Event Espresso Premium Expired events can still be viewed

Expired events can still be viewed

Posted: July 25, 2017 at 7:55 am

Viewing 5 reply threads


robbstcs

July 25, 2017 at 7:55 am

Hi,

We have successfully stopped expired events from displaying in the event lists, but if a user has bookmarked the page, or otherwise accesses the event though the url then they can see the event. This is causing confusion because they want to try and book for the past event!

Is there any way to prevent an expired event from displaying and instead show a message for them to navigate to the current events’ list?

Alternatively, if we can’t prevent display, is there any way that we can show a message in place of the tickets to tell them that the event is expired, and give them a link to the current events’ page? The ticket selector does not show on the expired events, but I can’t work out how to display a custom message in its place.

Thanks in advance


Josh

  • Support Staff

July 25, 2017 at 1:21 pm

Hi there,

Yes there are ways but in order to help you with this I need some clarification of what you mean by an expired event. For example do you consider this to be an expired event: An event where the ticket sales are done, but the event hasn’t happened yet?


robbstcs

July 27, 2017 at 1:46 am

Hi,
No, the problem is with events that have happened in the past but for some reason people can still view them.
For example:
http://keepactive.org.uk/events/sunderland-college-bede-campus-summer-week-4/

This is an event from last year – as you can see the tickets title is visible, but the tickets are not. Our problem is that people are accessing this page (not quite sure how) and then trying to book but don’t realise that they can’t because the event is in the past.

What we want to do is display a message underneath the tickets title which says that the event has finished, and direct them to the current list of events.
Thanks


Josh

  • Support Staff

July 27, 2017 at 11:44 am

I checked your site and there are a few improvements that can be made with regards to the SEO plugin adding the expired events to the XML sitemap. So the first thing I can recommend is those should get removed from the XML sitemap. This can be done automatically by adding some code to your site. Here’s a link to a gist:

https://gist.github.com/joshfeck/85dcc9947b8f406093498464f542e990

Here’s a link to another code example that can be used to set a “noindex” on the robots meta tag. This will also make it so these expired events are less findable:

https://gist.github.com/joshfeck/70979dc12f93ab25dd668ed4500be477

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.

It appears that your site uses custom templates to display the Ticket information (reason being there’s an evp-tickets division in the html, and that’s not something that Event Espresso adds). Can you post a pastebin or a gist of the template code that displays the ticket section? If you can, I can share with you some code that will display that message there when the event is finished.


robbstcs

July 28, 2017 at 2:29 am

Here’s the code for the event display
https://pastebin.com/SjNgWzWs

Thanks


Josh

  • Support Staff

July 28, 2017 at 7:42 am

OK thank you. Right after line 68 where you have:
espresso_ticket_selector();

You can add this to display the custom message:

$event = EEH_Event_View::get_event();
if ( $event instanceof EE_Event ) {
  if ( $event->is_expired() ) {
    // get event list URL
    $event_list_url = esc_url( home_url( 'events' ) );
    // output message
    $html = '<div class="ee-expired-custom-message">';
    $html .= 'Howdy! This event has finished. You are invited to peruse our ';
    $html .= '<a href="' . $event_list_url . '">';
    $html .= 'current list of events</a>.';
    $html .= '</div>';
    echo $html;
  }
}
Viewing 5 reply threads

The support post ‘Expired events can still be viewed’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso