Limited-Time Sale, up to 30% off! Go Pro, offer ends in | see announcement

Important changes to 5.5.3 and Pro 2.3.8

Posted on April 15, 2014

We’re intending on releasing versions 5.5.3 and Pro 2.3.8 very soon, and included in this update are some inevitable changes that may impact some customizations made by users as well as creating incompatibilities with earlier versions of Events Manager Pro.

This does not affect users that are able to update both EM and Pro, only users that want to upgrade the Free plugin but cannot upgrade Pro for whatever reason.

Every effort is made to make the updates to Events Manager compatible with earlier versions of Pro, but sometimes for the good of the plugin or for inevitable reasons (like in this case), things have to change.

This post should help developers understand why this has happened and what’s needed to bring custom code up to date. For less tech-savvy Pro users, skip down to the “How to ‘fix’ earlier versions of Pro” section.

If you are experiencing errors due to this upgrade, feel free to ask on our support forums, stating any error messages you’re getting, and we’ll do our best to advise you on how to get things back on track again.

We’re sorry for the inconvenience caused. Hopefully these sorts of changes should be few and far (although preferably never!) between.

Why these changes are necessary.

We had to make changes to the code in order to prevent various PHP Strict error warnings when running later versions of PHP. These strict errors were mainly due to the fact that we’re calling static methods that aren’t declared as static.

At the time of writing the offending code, PHP versions commonly used with WordPress and web servers did not throw strict errors when you did this, but as hosts update their PHP versions these strict error warnings became prevalent.

The use of the word ‘error’ may be misleading here, because it’s not really an error but a warning that gets output to error log files as well as the browser if the server environment is set to display errors on-screen (or if using WP_DEBUG).

What has been changed

The bulk of the changes are in the main/free plugin, and they mainly involve these three situations:

  • Changing functions so they are declared as public static functions
  • Changing any instances where these modified functions were not being called staticly (very few of these)
  • Changing method signatures (i.e. parameters) of extended classes so they match the function of parent classes

To make this as painless as possible, we’ve made a single commit in the WordPress SVN repo so that you can easily see the changes in one diff comparison, which you can find here.

The Pro version needed changing of two functions in the EM_Coupons class so they are static, given the parent EM_Object class are now also static.

Who they’ll affect

These changes will affect anyone running Events Manager Pro 2.3.7.5 or earlier. Additionally, this may affect users who have made customizations.

If you have followed the same convention we do in our plugin and tutorials when using functions such as EM_Events::get_search_defaults() or similar, then there likely shouldn’t be any problems, in fact you should see less warnings in your error log. However, if you are using any of these changes non-statically, then you will likely have fatal errors and the offending lines in your code should be changed.

Since it’s impossible to predict every situation when it comes to custom code, the general advise we can give to developers is to check the diff and see if there’s any functions they’re using that have changed, and if so, start calling that function statically instead. If you can test this out on a staging server, it may even be easier to update and fix errors as they’re reported, since there’s likely to be only a few lines requiring a change.

When will this affect me?

We will allow until at least Monday 21st April 2014 before pushing out a stable update. You can already download these changes in the latest dev versions.

How to ‘fix’ the Pro add-on

Fortunately, the changes in Pro are minimal, in fact, it just requires two line changes in one file to prevent fatal errors. For those that don’t have an active license, an renewal shouldn’t be required just for this, and we describe below how to fix this yourself.

Depending on your Pro version, the file will be located in one of these two locations:

  • /events-manager-pro/add-ons/coupons.php
  • /events-manager-pro/add-ons/coupons/coupons.php

Since this file may vary from version to version, we’ve created a search/replace instructions which will apply to all versions of the file. In a regular text editor, do a search and replace of these two phrases, which should be located near the bottom of the file. Do not replace the whole line, just the bits of text indicated below.

Search/replace this:

function build_sql_conditions

with this:

public static function build_sql_conditions

And search/replace this:

function get_default_search

with this:

public static function get_default_search

Once you’re done with these changes, you’ll also need to correct one line in /events-manager-pro/events-manager-pro.php so that the plugin isn’t deactivated automatically to prevent this fatal error.

Replace this line (the number 123 will vary depending on your Pro version):

define(‘EMP_VERSION’, ‘123’);

with this:

define('EMP_VERSION', '2.38');

18 Comments

  1. John Russell says:

    Thanks for making these updates! Is there an expected release date for the 5.5.3 update now that 4/21/2014 has passed?

    • marcus says:

      Yes, the dev version 5.5.2.6 (already available) is likely to be the next update, we’re working on some final touches for the Pro add-on as both have to be released at the same time due to the changes above.

  2. Frank says:

    Apparently, I don’t have an active license…and the “fix” won’t work as the two searchable files are not found! Of course, I can’t get support because my license is expired!

    • marcus says:

      Hi Frank,

      This is an exception where we’d be willing to help out if you’re still stuck with the above instructions. I replied to your email with the corrected file.

  3. Rita Neves says:

    Thanks Marcus for the help. I have done the changes on the code and now it is all ok. The message disappeared from administration backend.

    But now the plugin version PRO that we have, presents a possibility to upgrade. Should I upgrade and everything will work all right, since I have done the changes on the code?

    Or should I not upgrade the PRO version to 2.3.8.1 has suggested on our plugins wordpress page?

    Waiting for your reply. Thanks in advance.

    Rita Neves

  4. Sara says:

    I can’t find those files to fix. I’ve tried doing a search on my PC

  5. Jae says:

    Is this just an excuse to force me to buy a new Pro license? I don’t see why it’s “necessary” for you to disable older version of Pro. Granted, the updates might be necessary for those who want the latest version. But the older versions should work well enough. Whilst your plugin works well, I do not see that you really give true value in the license fee for upgrading. I rarely, if ever need to use support. So renewing my Pro licenses is not worth the money. And as far as I can see, the REAL reason for you disabling older versions of Pro is to force us to purchase a new license.

    • marcus says:

      Hi Jae, I think you misunderstood our intent here. We wrote this post specifically for those that don’t want to update their Pro version yet still want to update the free version.

      The disabling of the plugin was necessary to prevent you from not being able to access your site due to a fatal error that can occur without following the instructions above. Unfortunately there was no way around this.

      No are renewals necessary to maintain a working version of your Pro version, and we do our best to maintain backwards compatibility with newer versions of the free/main plugin.

  6. marcus says:

    Hi Rita,

    If you still have access to updates, I’d definitely recommend updating and the changes above wouldn’t be necessary as they’re already included in the latest updates.

    These is specifically for people who are happy with their current Pro version and don’t want to renew their license just for the sake of fixing this particular issue when updating the main/free plugin from wordpress.org.

  7. Rita Neves says:

    Hi Marcus,

    We have access to updates. But know I want to upgrade de version. Since I have already change the code, please explain me well How to update?

    Best,

    Rita Neves

  8. Maarten says:

    When I try to upload the corrected php files it does not work. I get this notice: 553 Can’t open that file: Permission denied. Does anyone know how to fix this?

    • marcus says:

      you may want to ask your hosts about this. the issue is due to file permission issues.

      If you can upload a file to wp-content/plugins via FTP without having the permission error, then you could try deleting the plugin from the WP dashboard and then re-uploading the whole events-manager-pro folder again.

  9. Meghan says:

    Although my registration is working now, it is not taking the customer over to PayPal although it’s set up. Help!

  10. Angie says:

    So I did everything you suggested here but I still received a fatal error.

    Plugin could not be activated because it triggered a fatal error.
    Parse error: syntax error, unexpected ‘.38’ (T_DNUMBER) in /home/therapyc/public_html/wp-content/plugins/events-manager-pro/events-manager-pro.php on line 12

    Please help me get this activated again.

    • marcus says:

      Hi Angie,

      Some browsers may be messing up the quotations copying/pasting that line of code, so I’ve added syntax highlighting to that line so you can copy it correctly.

      I’d still suggest you make sure the ‘2.38’ is surrounded by single quotes after pasting by manually deleting and retyping the quote marks.



Interested in Events Manager?

Sign up to our newsletter, receive a free add-on and an additional 10% discount for Pro!

You will receive a confirmation email which you must click on, you will then be sent another welcome email with links to your discount and free add-on.