Support

Home Forums Event Espresso Premium Plugin conflict with WP-EMail plugin

Plugin conflict with WP-EMail plugin

Posted: October 6, 2014 at 1:48 pm

Viewing 2 reply threads


Paul Pehrson

October 6, 2014 at 1:48 pm

FYI,

There seems to be a plugin conflict with the plugin WP-EMail plugin (Version: 2.63 Author: Lester ‘GaMerZ’ Chan).

When WP-EMail is installed, when a user tries to register for a course using EE 3, somehow the function gets picked up by WP-EMail, and has you send the event to a friend. You never see the payment confirmation pages.

When I disable the WP-EMail plugin, EE works correctly. Looks like maybe EE and WP-EMail have the same name for a function or something so it calls the WP-EMail function instead of the correct EE function, but I’m not sure. I haven’t looked at the code.

My site is PaulPehrson.com.

I’m using the following EE plugins:

EE (Core) v. 3.1.36.6P
EE – calendar v 2.2.4p
EE – Custom Template Display v. 1.0
EE – Multi-Event Registration v. 1.0.5p
EE – Recurring Events v. 1.1.8p
EE Template – Recurring Events Table w/ Dropdowns V 1.0


Tony

  • Support Staff

October 7, 2014 at 4:49 am

Hi Paul,

Whats happening here is WP-Email is checking $wp_query->query_vars for ’email’ and if it exists, completely takes over and re-directs the user to the WP-Email form.

If you notice when you go to /event-registration/ there is no problem, when you enter the registration page (which is still on the /event-registration/ page) again no problem. It is when you have entered your Personal info (specifically email) Event Espresso passes this using query_vars, email is part of that and WP-Email does this:

### Function: Load WP-EMail
add_action('template_redirect', 'wp_email', 5);
function wp_email() {
	global $wp_query;
	if( array_key_exists( 'email' , $wp_query->query_vars) ) {
		include(WP_PLUGIN_DIR.'/wp-email/email-standalone.php');
		exit();
	} elseif( array_key_exists( 'emailpopup' , $wp_query->query_vars ) ) {
		include(WP_PLUGIN_DIR.'/wp-email/email-popup.php');
		exit();
	}
}

So any plugin that passes ’email’ will be re-directed, with no easy way to override this. The quick fix is to modify the function to do something like this:

### Function: Load WP-EMail
add_action('template_redirect', 'wp_email', 5);
function wp_email() {
	global $wp_query;
	if( array_key_exists( 'email' , $wp_query->query_vars) && !is_page( 'event-registration' ) ) {
		include(WP_PLUGIN_DIR.'/wp-email/email-standalone.php');
		exit();
	} elseif( array_key_exists( 'emailpopup' , $wp_query->query_vars ) ) {
		include(WP_PLUGIN_DIR.'/wp-email/email-popup.php');
		exit();
	}
}

‘event-registration’ should be changed to whatever your [ESPRESSO_EVENTS] page is although there may be more pages this is needed on.

However this is not a recommended fix, nor can we provide further support for this unfortunately. The WP-Email plugin ideally needs to add a filter to that function to allow you to set ‘excluded’ pages from their redirect which will remove the need to modify core files/functions.


Tony

  • Support Staff

October 7, 2014 at 8:35 am

Hi Paul,

We discussed this further and @Josh had the idea to simply remove the action on template_redirect for registration pages so we’ve put together a little function to do just that.

https://gist.github.com/Pebblo/14c735131cf6c969c24f

You can add that to your themes functions.php file or a site specific pluginhowever be aware of the plugins load order for the is you do so as it will make a difference to the function.

This way your not editing core files just remove and action that the plugin created.

Viewing 2 reply threads

The support post ‘Plugin conflict with WP-EMail plugin’ 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