Support

Home Forums Event Espresso Premium Extremely slow loading time on EE 4.9.70.p using PHP 7

Extremely slow loading time on EE 4.9.70.p using PHP 7

Posted: November 16, 2018 at 12:05 pm


Michael

November 16, 2018 at 12:05 pm

I’m not exactly sure when things started to slow down. Perhaps mid October 2018 after some updates. However all pages on my website with EE4 are running incredulously slow. The rest of the site works as expected.

Website: https://h11dfs.com/certified-training/

EE 4.9.70.p
Wordpress 4.9.8
PHP PHP/7.0.32

I am not seeing any plugin conflicts or misaligned settings. Pingdom and other speed tools are just indicating long wait times for EE4. My page assets all load fine. – I am seeing a “set-cookie” from EE4 that I am not sure is related or not.

Any help would be greatly appreciated.


Josh

  • Support Staff

November 16, 2018 at 12:12 pm

Hi,

You could do a backup of the database, then run the optimize tables script. I’m seeing “Error establishing a database connection” errors sporadically as I browse to different pages on your site, which is an indication the database server is under load.


Michael

November 16, 2018 at 12:15 pm

Hey Josh, I was just in the middle of that which is why you saw the error. Bad timing. Sorry about that. Would you mind looking again?


Josh

  • Support Staff

November 16, 2018 at 12:20 pm

You were in the middle of optimizing the database tables? Did that seem to help?


Michael

November 16, 2018 at 12:22 pm

Correct. Unfortunately after running table optimization and clearing cache the issue still persists.


Josh

  • Support Staff

November 16, 2018 at 12:33 pm

One difference is most pages on your site are being served from a cache, which speeds things up, but the EE single event pages are not served from a cache. So those will naturally be slower since you probably shouldn’t cache event pages when they need to be dynamic.

Specific to pages like this one:
https://h11dfs.com/certified-training/advanced-isp-jtag-data-recovery/
seem to load fast, but the source reveals that WP Super Cache took over 5 seconds to build the cache, which is slow. If you have a custom template for the events table template, some code within that template could probably be removed to help speed things up. If that’s the case, can you post a gist of a pastebin of the custom template?


Michael

November 16, 2018 at 12:46 pm

I’m not sure WP Super Cache is not treating the EE4 pages the same as the rest of the website. Everything was pretty speedy until about three weeks ago. I do remember that there was a WP Super Cache update recently.

As far as custom templates go, my EE4 pages are all stock. The only change I can think of is I edited the PHP EE4 Table template. I only replaced the word “Venue” for “Location” – but that was really the only customization. The only other customizations are a few CCS cosmetics in my Theme.


Josh

  • Support Staff

November 16, 2018 at 12:51 pm

I’m not sure WP Super Cache is not treating the EE4 pages the same as the rest of the website.

WP Super Cache should not cache EE4 event pages, because EE4 tells WP Super Cache not to. If it did cache the event registrations pages, you would end up with errors on the registration page.

The only change I can think of is I edited the PHP EE4 Table template. I only replaced the word “Venue” for “Location” – but that was really the only customization

That’s a problem that needs solving, because your “stock” template isn’t stock anymore compared to the new version of the events table plugin. If you can post the contents of your custom template to a pastebin or gist I can point out where to make an edit that will help speed up the load of the pages with the table template.


Michael

November 16, 2018 at 1:08 pm

I appreciate your help. Looking at this code jogs my memory that I did add a line in the template to duplicate the registration link onto the event title.

Full template below.

espresso-events-table-template.template

<?php
// Options
$date_format = get_option( ‘date_format’ );
$time_format = get_option( ‘time_format’ );
// Load Venue View Helper
EE_Registry::instance()->load_helper(‘Venue_View’);
//Defaults
$reg_button_text = !isset($reg_button_text) ? __(‘Register’, ‘event_espresso’) : $reg_button_text;
$alt_button_text = !isset($alt_button_text) ? __(‘View Details’, ‘event_espresso’) : $alt_button_text;//For alternate registration pages
$sold_out_button_text = !isset($sold_out_button_text) ? __(‘Sold Out’, ‘event_espresso’) : $sold_out_button_text;//For sold out events
$category_filter_text = !isset($category_filter_text) ? __(‘Category Filter’, ‘event_espresso’) : $category_filter_text;

if ( have_posts() ) :
// allow other stuff
do_action( ‘AHEE__espresso_events_table_template_template__before_loop’ );
?>

<?php if ($category_filter != ‘false’){ ?>
<p class=”category-filter”>
<label><?php echo $category_filter_text; ?></label>
<select class=”” id=”ee_filter_cat”>
<option class=”ee_filter_show_all”><?php echo __(‘Show All’, ‘event_espresso’); ?></option>
<?php
$taxonomy = array(‘espresso_event_categories’);
$args = array(‘orderby’=>’name’,’hide_empty’=>true);
$ee_terms = get_terms($taxonomy, $args);

foreach($ee_terms as $term){
echo ‘<option class=”‘ . $term->slug . ‘”>’. $term->name . ‘</option>’;
}
?>
</select>
</p>
<?php } ?>

<?php if ($footable != ‘false’ && $table_search != ‘false’){ ?>
<p>
<?php echo __(‘Search:’, ‘event_espresso’); ?> <input id=”filter” type=”text”/>
</p>
<?php } ?>

<table id=”ee_filter_table” class=”espresso-table footable table” data-page-size=”<?php echo $table_pages; ?>” data-filter=”#filter”>
<thead class=”espresso-table-header-row”>
<tr>
<th class=”th-group”><?php _e(‘Event’,’event_espresso’); ?></th>
<?php if( $show_venues ) { ?>
<th class=”th-group”><?php _e(‘Venue’,’event_espresso’); ?></th>
<?php } ?>
<th class=”th-group”><?php _e(‘Date’,’event_espresso’); ?></th>
<th class=”th-group” data-sort-ignore=”true”></th>
</tr>
</thead>
<?php if ($footable != ‘false’ && $table_paging != ‘false’){ ?>
<tfoot>
<tr>
<?php echo ‘<td colspan=”‘ . ($show_venues ? ‘4’ : ‘3’) . ‘”>’; ?>
<div class=”pagination pagination-centered”></div>
</td>
</tr>
</tfoot>
<?php } ?>
<tbody>

<?php
// Start the Loop.
while ( have_posts() ) : the_post();
// Include the post TYPE-specific template for the content.
global $post;

//Debug
//d( $post );

//Get the category for this event
$event = EEH_Event_View::get_event();
if ( $event instanceof EE_Event ) {
if ( $event_categories = get_the_terms( $event->ID(), ‘espresso_event_categories’ )) {
// loop thru terms and create links
$category_slugs = array();
foreach ( $event_categories as $term ) {
$category_slugs[] = $term->slug;
}
$category_slugs = implode(‘ ‘, $category_slugs);
} else {
// event has no terms
$category_slugs = ”;
}

}
//Create the event link
$external_url = $post->EE_Event->external_url();
$button_text = !empty($external_url) ? $alt_button_text : $reg_button_text;
$registration_url = !empty($external_url) ? $post->EE_Event->external_url() : $post->EE_Event->get_permalink();

//Create the register now button
$live_button = ‘ID.'” class=”a_register_link” href=”‘.$registration_url.'”>’.$button_text.’‘;

if ( $event->is_sold_out() ) {
$live_button = ‘ID.'” class=”a_register_link_sold_out a_register_link” href=”‘.$registration_url.'”>’.$sold_out_button_text.’‘;
}

// If the show_all_datetimes parameter is set set the limit to NULL to pull them all,
// if not default to only display a single datetime.
$datetime_limit = $show_all_datetimes ? NULL : 1;

// Pull the datetimes for this event order by start_date/time
$datetimes = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, $show_expired, false, $datetime_limit );

// Reset the datetimes pointer to the earliest datetime and use that one.
$datetime = reset( $datetimes );
if ($datetime instanceof EE_Datetime) {
?>
<tr class=”espresso-table-row <?php echo $category_slugs; ?>”>
<td class=”event_title event-<?php echo $post->ID; ?>”><?php echo $post->post_title; ?></td>
<?php if( $show_venues ) { ?>
<td class=”venue_title event-<?php echo $post->ID; ?>”><?php espresso_venue_name( NULL, FALSE ); ?></td>
<?php } ?>
<td class=”start_date event-<?php echo $post->ID; ?>” data-value=”<?php echo $datetime->get_raw( ‘DTT_EVT_start’ ); ?>”>
<ul class=”ee-table-view-datetime-list”>
<?php
// Loop over each datetime we have pulled from the database and output
foreach ($datetimes as $datetime) {
?>
<li class=”datetime-id-<?php echo $datetime->ID(); ?>”>
<?php echo date_i18n( $date_format . ‘ ‘ . $time_format, strtotime( $datetime->start_date_and_time(‘Y-m-d’, ‘H:i:s’) ) ); ?>

<?php
//end foreach $datetimes
}
?>

</td>
<td class=”td-group reg-col” nowrap=”nowrap”><?php echo $live_button; ?></td>
</tr>
<?php
}
endwhile;
echo ‘</table>’;
// allow moar other stuff
do_action( ‘AHEE__espresso_events_table_template_template__after_loop’ );

else :
// If no content, include the “No posts found” template.
espresso_get_template_part( ‘content’, ‘none’ );

endif;


Josh

  • Support Staff

November 16, 2018 at 1:22 pm

It’s really best to post entire templates into a pastebin or gist, the reply field isn’t suited for large blocks of code.

It looks like your template already uses
if ( $event->is_sold_out() ) {
so that part is OK.


Michael

November 16, 2018 at 1:26 pm

Sorry. I was not sure where pastebin was.

The support post ‘Extremely slow loading time on EE 4.9.70.p using PHP 7’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Michael 12 months ago ago

Topic Tags

Tagged: , ,

Notifications

This topic is:
pending
Do NOT follow this link or you will be banned from the site!