Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

Generating Messengers vs Sending Messengers

In Event Espresso 4.5.0, we introduced greater flexibility with the ability for a Messages system messenger to function as either a generating messenger or as a sending messenger. This document is a high level overview of what this means and why the changes have been made.

What's the difference?

  • when a messenger functions as a generating messenger, it is used to generate message templates in combination with whatever message type was triggered. ** when a messenger functions as a sending messenger, it is used to send the already generated message templates. an important thing to remember is that messengers are NOT one or the other. In other words, its entirely possible for a messenger class (i.e. html) to function as both a generating messenger AND sending messenger depending on what message type was triggered using that messenger. So it is NOT a property inherent to the messenger class itself but is more how the messenger is utilized by the message type. ** message types now define a _with_messenger property that is an array of acceptable messengers that can be a sending messenger for that message type and then the values for each generating messenger key, is an array of messengers that can be used to SEND messages generated by that messenger with the given message type (an example of this is given in the next section).

An Example of this in Use

The new [DISPLAY_HTML_URL] shortcode introduced in 4.5.0 utilizes the new URL based trigger available to the messages system. A "URL trigger" is an action captured by the EED_Messages module and includes a value for generating messenger and a value for sending messenger. So in the case of the [DISPLAY_HTML_URL] shortcode, when used with the various original message types (such as registration message type or payment received message type), these message types have defined their new _with_messenger property as this:

//in __construct()
$this->_with_messenger = array( 'email' => array('html'));

This basically means that whenever this message type is triggered, the allowed generating messenger is 'email', and the allowed sending messenger for messages generated by that message type and messenger (email) is html.

So, when someone clicks on the url created by the usage of the [DISPLAY_HTML_URL], the url contains information about the message type, the generating messenger, and the sending messenger. The message is generated using the templates provided by the message type and generating messenger, and the generated message is SENT using the sending messenger.

Wrapup

For those working with the EE messages system, you'll notice references to generating vs sending messengers throughout the code. Now you know what those terms mean!