Events Manager 5.8

Posted on November 14, 2017

We’re pleased to announce the release of Events Manager 5.8. This announcement post will be longer than usual, as it adds a lot of under the hood improvements, loads of bug fixes, and a few new features to boot worth going over in more detail.

One more thing… ;) whilst there’s lots to cover in this release, we’re already nearing completion of our next update which will introduce timezone support to events. See the section further down for more details!

New Features and Improvements

Performance Improvements

We’ve made some important improvements to how events, bookings and locations are loaded which will yield significant performance improvements for many, most notably those with larger numbers of events and bookings. In some cases, we’ve seen a 90%+ decrease in database lookups for a single page, which translates to much faster page loads!

We’d love to talk more specifically about the improved areas, and we’ll do so further down in the developer notes, since it can be somewhat techy. One thing worth knowing, is that a specific improvement we’ve made has temporarily been limited so that it’s only applied if this line of code is added to your wp-config.php file:

define('EM_DISABLE_OPTIONAL_JOINS', true);

Whilst we’re quite happy with the results and have extensively tested this out, given the multitude of possible setting combinations available in EM, we can’t test them all and so we’d like to give the opportunity to everyone to try this out on their specific installs before we enable it by default in an upcoming release. If it doesn’t work for you, remove that line and let us know what went wrong on our support forums!

Event and Location List Grouping

A regularly requested feature is to be able to list upcoming events, but only show the first recurrence of each recurring event set. We’ve gone a step further to not only allow this sort of list, but to group lists by pretty much any field in our event and location tables! We’d like to introduce you to the new groupby, groupby_orderby and groupby_order attributes, which you can use in shortcodes and PHP search functions! By using these attributes, you can do things like retrieve or show:

  • a list of upcoming events, showing both single and recurring events, but only the next upcoming recurrence per recurring event.
  • a list of locations, but show the first alphabetical town per country.
  • a list of upcoming events, showing only the LAST upcoming event in each state

The possibilities are endless! Combined with our other search attributes, you can get even more creative:

  • a list of recurring events (no single events), belonging to a specific category, showing only the next event in each town located within a specific geographical radius.

This is a pretty powerful/complex feature which can quite easily be confused with the order and orderby options, so we’ve created some extra documentation to clarify the differences and give some examples as to how this can be used effectively.

New Placeholders and Conditional Placeholders

We’ve added a couple of new conditional and regular placeholders which will help you improve how you display your event information, and are also found in our documentation.

Placeholders

For Placeholders, we’ve added two useful ticket related ones, called #_EVENTPRICEMINALL and #_EVENTPRICEMAXALL. Similar to #_EVENTPRICEMIN/MAX placeholders, these show the minimum and maximum ticket prices, but include all ticket prices rather than just those available to that viewer at that specific time.

We’ve also added webcal placeholders, which is essentially ical links, but format the link using the webcal:// protocol rather than http(s):// which is useful for some calendar apps. These are available for individual events, locations, categories and tags, using the format #_xWEBCALLINK such as #_CATEGORYWEBCALLINK.

Conditional Placeholders

OK, so we haven’t ‘added’ a new conditional placeholder but we’ve improved how the category and tag conditional placeholders work, allowing much more flexibility. Now, you can include multiple tags or categories within the placeholder so only certain content is shown/hidden from users. Previously, you could only use one tag in the conditional placeholder:

{has_tag_cooking-class}Bring your own ingredients!{/has_tag_cooking-class}

Now, you could use multiple categories in one placeholder filter:

{has_tag_cooking-class,bbq}Bring your own ingredients!{/has_tag_cooking-class,bbq}

Important Notes for Developers

There’s various improvements here that we’d like to get techy about, especially since they may affect some developers working with the plugin.

Taxonomy objects have been rewritten

Whilst most developers, even those making use of our hooks to manipulate or extract information, this won’t affect you. However, it’s worth noting anyway. We’ve restructured our category and tag objects so that most of the heavy lifting is done by an abstract parent class. Much of the same logic required to manage both taxonomies are handled by one set of code which reduces the probability for errors, simplifies maintenance.

Aside from that, one important advantage for developers is that integrating a custom taxonomy for Events Manager has never been easier! Take a look at how we’ve done this with our own Category/Tag objects within the classes folder. With minimal amounts of code you can couple a taxonomy to Events or Locations and even make use of our placeholders automatically!

We’ve also renamed the these classes:

  • EM_Categories_Taxonomy > EM_Categories_Admin
  • EM_Category_Taxonomy  > EM_Categories_Frontend
  • EM_Tags_Taxonomy > EM_Tags_Admin
  • EM_Tag_Taxonomy > EM_Tags_Frontend

In case you’ve thought up of a scenario where you needed to use these classes outside the core plugin, you’ll want to tweak your code accordingly.

Optimized EM_Events and EM_Locations Lookups

This could also be considered a performance tweak, but worth mentioning separately as you can also implement these tweaks to your own code.

Previously, when loading events or locations of any kind, you’d want to first obtain a specific number of events (e.g. limit to 20 events) and also know how many events in total are available, in case you’d like to add a ‘more events’ link, or some sort of pagination style. Previously, this required two functions which forced two separate SQL calls:

$events = EM_Events::get( array('limit' => 20, 'pagination' => 1) );
$events_count = EM_Events::count();
...

If you’re using the above code (note the use of ‘pagination’), we recommend making a small tweak. Now, only one lookup is needed, as we also determine the total number of events without limits in the same query, and store it in a static variable like so:

$events = EM_Events::get( array('limit'=> 20, 'pagination' => 1) );
$events_count = EM_Events::$num_rows_total;

You can also access the EM_Events::$num_rows to determine how many events were actually returned by the ‘get’ statement, rather than running count($events) on the above code. Those of you that regularly use $wpdb will notice the similarity.

Performance Tweaks

As mentioned further up, we’ve made some important tweaks that can dramatically improve performance in some areas of the plugin. This specifically revolves around events, locations and bookings. We’d like to talk a little more about it here…

For locations and events, we’ve leveraged the use of WordPress’ caching features. This enables two significant performance improvements; firstly when displaying the same event on different parts of the page (for example viewing an event list/page with another events widget on the sidebar), Events Manager does not need to recreate the object each time, saving unnecessary database lookups and overhead. Secondly, if you’re using caching plugins which leverage object caching you’ll also see performance improvements from page to page, since reloading the same page does not require a trip to the database when looking up the same event.

Aside from caching, we’ve also improved our SQL statements so that when searching for events or locations, we won’t search (join) the events or locations tables unless it’s necessary.

The way bookings are retrieved and totals are calculated have been rewritten to optimize performance. In short, individual bookings of an event are not loaded for reference unless absolutely necessary, and not loaded at all when counting bookings such as pending bookings, confirmed bookings, booking totals, etc. This has shown huge performance gains by dramatically reducing the number of SQL queries on a single page load, especially when dealing with events containing hundreds or thousands of bookings.

One more thing…

We’ve been working on another greatly anticipated feature… Timezone support! We were hoping to add this to 5.8, but as development ensued, it became clearer that this is a pretty big feature in terms of the subtle yet fundamental changes required in terms of coding. Therefore, we decided to firstly release all the other improvements we had already and follow up with a beta of this new feature in the form of a dev version that anyone can test out and provide us with feedback before we release it.

Whilst it should only be a matter of days until we release the beta (likely to be named 5.8.0.1 and released officially as 5.8.1), we’ll follow up with another post dedicated to what’s coming in terms of timezone support.

Changelog

Last but not least, here’s the full list of specific changes/improvements/fixes we’ve made in Events Manager 5.8. Enjoy!

  • fixed category color picker and image uploader problems
  • created base classes for EM taxonomies to make adding custom EM taxonomies even easier in the future,
  • added tag image and color settings/data
  • added sortable option for date columns of events and recurring events in the admin area
  • fixed saving an event recreating ticket_meta and wiping out ML settings
  • fixed multilingual translations of event in WPML not hiding/showing right meta boxes
  • fixed saving multilingual translation of event overwriting original language ticket names
  • changed admin headers to use new and accessible WP inline HTML structure
  • fixed serialization problems for deprecated event/location attributes and attributes with multiple post meta entries for one post
  • removed deprecated attributes editor from admin area as this is confusing and error prone when combined with other plugins manipulating custom fields
  • fixed #_EVENTEXCERPT without arguments stripping HTML since 5.7
  • added ability to list multiple categories/tags in conditional placeholders e.g. {has_tag_123,1234,tagname}…
  • added #_EVENTPRICEMINALL and #_EVENTPRICEMAXALL to show prices of unavailable tickets as well
  • fixed JS issues with MS Global mode and JS file limiting when displaying subsite single event pages on main blog
  • fixed single initial abbreviation issues in Chinese calendars
  • fixed duplicate events not being published to social networks via jetpack publicize (kudos @gnaag)
  • fixed potential incompatibilities with other plugins using wp_query_reset() on category pages, preventing our page formats from showing
  • fixed taxonomy archive pages returning zero results if taxonomy formatting is disabled and events are excluded from searches (WP Bug workaround)
  • fixed inconsistent line ending causing warnings with PHP compatibility checker
  • unified Tag and Category class functions into sets of parent class functionn
  • fixed PHP fatal error with BP when disabling notifications
  • fixed calendar day links being incorrect if another plugin adds querystring params to permalinks
  • added groupby, groupby_orderby and groupby_order arguments allowing grouping in search results for events and locations
  • improved validation and sanitization of orderby arguments to avoid ambiguous field SQL errors
  • added optimization to optionally join event/location tables when needed for grouped searches or if EM_DISABLE_OPTIONAL_JOINS is defined and set to true
  • moved condition of when argument ‘bookings’ = ‘user’ to EM_Object so it’s accessible by EM_Location too
  • changed default ‘recurring’ argument to null so that non EM_Events searches can by default avoid the recurring conditional being generated
  • added grouping to AJAX response for event_map shortcode and function resulting in performance improvements
  • fixed use of get_terms via deprecated two argument method
  • fixed recreation of tickets for a recurring event having wrong start/end ticket dates
  • fixed custom fields with a 0 value getting deleted instead of saved
  • fixed/changed – shortened SQL search conditions when filtering by array or comma list of event/location ids
  • fixed escaping of apostrophes on search term placeholder
  • added optimized result counts (EM_Events::$num_rows and EM_Events::$num_rows_total) in EM_Events::get() to reduce number of SQL calls
  • added optimized result counts (EM_Locations::$num_rows and EM_Locations::$num_rows_total) in EM_Locations::get() to reduce number of SQL calls
  • changed as a result of the above two additions above we tweaked various event list areas to half number of SQL queries run per list
  • added no_results_msg argument to EM_Events::output() functions for custom ‘no events found’
  • added location_status and event_status search arguments to event and location searches respectively
  • fixed column alignment issues when using quick edit for events in wp dashboard
  • tweaked excerpt filters and reduced redundant calls to our the_content filters (reducing overhead)
  • changed event page the_content loading so it only shows when in_the_loop() and is_main_query() is true
  • fixed issues with WordPress SEO plugin breaking the wp editor front-end
  • added event list default sorting options to locations, tags and categories
  • added em_wp_is_super_admin() replacing is_super_admin() in anticipation of its deprecation
  • changed and optimized postmeta saving process to reduce number of rows by up to 80% per event,
  • optimized events table to save NULL values when possible
  • changed/removed unused event_category_id field from events table
  • added em_object_can_manage filter
  • fixed nested attributes such as {cond}#_ATT{name}{/cond} not being parsed properly
  • fixed some installation SQL PHP errors/warnings
  • fixed capability mapping problems if revisions enabled for events or locations
  • added WEBCAL placeholders to events, locations, categories and tags (e.g. #_EVENTICALLINK > #_EVENTWEBCALLINK)
  • removed unnecessary SQL queries for undeclared wp_options reducing number of queries made per page load
  • tweaked settings page textarea elements to be wider
  • added (possibly temporary) EM_FORCE_RECURRENCES_SAVE constant forcing status save for when recurrences change status,
  • fixed EM_Event::set_status_events() which was not working correctly and now also runs a em_event_set_status_events filter
  • fixed recurring events warning text not appearing in front-end editor if first submission produced validation errors
  • performance improvements to EM_Bookings and EM_Ticket objects by preventing pre-loading of all bookings on instantiation and when querying availability
  • added cache optimization for event and location loading,
  • improved optimized loading of EM_Location via em_get_location() by checking globals first,
  • changed bookings/tickets template for event editor to avoid loading all bookings for counting purposes
  • added $include_adjustments argument to get_price_pre_taxes and get_price_post_taxes for calculation of prices without discounts/surcharges (those making use of the em_booking_get_price_post_taxes and em_booking_get_price_pre_taxes filters should check for this passed argument in their custom code)
  • fixed bug where event categories saved via quick or bulk edit in multisite global mode aren’t reflected in subsite event lists filtering by that category
  • fixed events created before changing to multisite and enabling global mode not displaying images via placeholders
  • fixed bug in filter em_ticket_get_post where function argument $post was not passed on
  • improved taxonomy color retrieval so it makes use of caching
  • improved/optimized deletion of multiple bookings and tickets at once if belonging to an event
  • fixed my_bookings shortcode outputting content at top of content irrespective of where it is located within content
  • fixed invalid recurrence ticket start/end cut-off date/times if both are not set for the recurring event
  • fixed bug where ticket start/end dates cannot be unset in recurring events

5 Comments

  1. Rob says:

    After updating to 5.8.0.1, my events are not showing up anymore. The word CONTENTS is only showing.

    • marcus says:

      Hi Rob, can you please put this forth to our support forums? We’ll be happy to help you troubleshoot this further.

      My guess is that your theme may be causing this, which you can verify by switching to a default WP theme. We introduced an extra check for our content to make sure we’re overwriting the pages within the main WP loop, but some themes we’ve found aren’t using this standard WP practice. If we can take a look at your theme, maybe we can suggest a workaround.

    • marcus says:

      To Rob (and others), we’ve confirmed this is a conflict with certain themes and the way they go about generating their content.

      If you’re seeing CONTENTS in your assigned event pages (e.g. event lists, location lists etc.) or no more content generated by EM, please see this support thread for more information on why it may be happening and how to get the fixed update.

Leave a Reply

This comment area is for discussion, not obtaining support. If you are having issues installing or using Events Manager, please visit either our Free or Pro support forums and we'll be happy to help you there.