Product Support

Email Expansion Kit

Provides several new ways to send emails with Participants Database, including email on approval, resend signup email, and custom email to selected records in the list.

Product Setup

Creating an Email Template

After installing and activating the plugin, the first thing to do to configure this add-on is to define your custom email. In the admin menu, under “PDb Email Templates” select “new template” and you’ll be shown a screen where all the components of your email template are defined.

Each template has a name that is used to identify the template and its purpose. Below that, you have fields for defining the sender name and email, and also the recipient name and email. All of these fields can be filled using a value tag so that, for instance, the email goes to the name and address defined in the record.

An email must have a subject, you can use value tags there as well if you want to personalize the subject line.

The body of the email may contain HTML, styled text, links, images, etc. and use value tags as well.

Below the email body, you can set up email attachments. Simply select the file you want to attach, and it will be sent with the email when it goes out. To add another attachment, click on “add attachment” and choose another file to include.

Value Tags

In the email template and subject settings, you can use value tags to show a value from the record that is associated with the template. These tags take the form of [fieldname] and you can include any defined field in the record that way.

There are also additional value tags that can be used:

  • [record_link] provides a link to the user’s editable record
  • [admin_record_link] provides a link to the record in the admin
  • [single_record_link] provides a link to the record (not editable) display page
  • [date] shows the current date using the site’s date format setting
  • [time] provides the current time using the site’s time format setting
  • [change_log] shows a table with all the before/after changed values
email-template-set-send-action
Configuring the email send action

Configuring the Send Trigger

Each email template is configured to be sent under certain conditions. Usually, this is when a specific event occurs, such as a record update, or a record gets approved.

Under the “Send Action” title is a dropdown selector where you can choose the event or action that will trigger sending this template email.

Sending Manually

To send an email to selected records on the list manually (such as a newsletter or announcement) select Admin List “With Selected” Action for your action. The sending occurs on the Participants Database admin list participants page: select the records you want to get the email, then select your email template in the “with selected” action dropdown. Hit “apply” and confirm to send the email to all selected records.

Setting Up Conditional Sending

email-template-set-conditional
The Send on Condition Panel

When an email template is triggered, you can check the values in the current record (an email send event is always associated with a record) to see if the template should be used. There are three basic ways the conditional send can be used:

Compare the value of a field in the current record against a fixed value

  • this is best for determining what kind of record it is so you can use different templates for different kinds of records

Compare a value in the current record against the previously saved value

  • this is for triggering an email if a specific value in the record has been changed

Compare the currently selected locale against a list of locales

  • this is so you can define different templates for different languages

Comparing Against a Fixed Value

If you need to send a particular email based on the value of a field in the record, this will allow you to do that. For instance, you could have two different “welcome” emails for your members, one for each of two types of membership. The incoming value is compared to the comparison value and if the operation resolves as “true” the email is sent.

The comparison value can be any value you need to compare. It can also be a comma-separated list of values. If any of those values resolves as “true” the email template will be used.

Send on Field Value Change Only

If the condition is set to trigger when a specific value is selected, this preference will only trigger the email the first time the value is selected.

Comparing Against a Saved Value

This is used when you want to send out an email when a particular value in the record has been changed. For instance, if a member changes their email address, an administrator gets notified.

Comparing Against the Current Locale Setting

If you have a multilingual site, you can set up a different email template for different locales. There are two ways to do this, depending on how the multilingual aspect of your site works.

You will need to have an email template for each language you want to support.

If the site provides a way to let the user select their preferred language, the selected language will be the “current locale” value. You can use that value to select the email template to use. In this mode, the comparison value should be one or more language codes (separeted by a comma if there are more than one) that the template should be used for. It is important that the language code in the comparison value exactly match the code the website is using. A list of the codes WordPress uses can be found here.

It is also possible to use a value in the record to determine the email template. If the user can select a preferred language in their record, you can use that value to determine which template to use. You do this using the “Field Value to Fixed Value” setting, and the comparison value works the same as it would using the current locale value.

User Feedback Messaging

For the “signup submission” and some other actions, the user is presented with a feedback message on the screen, and this can be customized on a per-template basis as well. Just put your message in the “user messaging” field and it will be presented to the user. Each template has it’s own user messaging field, so each type of signup (for instance) can have different messaging.

Email Session Send Limit

This plugin is not intended to be used as a mass-emailer: it has a built-in limit to the number of emails that can be sent in a single session. This means that if you try to send an email to more than 100 (the default limit value) recipients, only the first 100 will be sent. The main reason for this is the plugin does not have the capability for extended operation that would be needed to send to a larger list of recipients. Technically, the script sends all the emails in one operation and most servers will have a limit to how long a single operation can run, typically 30 seconds.

The easiest way around this limitation is to send your emails in batches of 100. If that is not practical, I’d suggest you use either a newsletter plugin or a 3rd party mass-email service.

Another consideration is the plugin does not provide a mechanism for an “opt-out” or unsubscribe which is required by law on mass email in some areas. If you are using shared hosting, in most cases sending mass email is not allowed, and there will be a low limit to the number of emails sent in a hour. While it is possible to override the plugin email session send limit value, this is not a supported use of the plugin.

An Example of Using a Comparison Against a Fixed Value

To illustrate this, let’s suppose you have a registration form for two different kinds of registrations: one for students and one for teachers. To set this up, create a new template, (it will be for the students) and set the “Send Action” to Signup Submission. Enable the “Send On Condition” checkbox and below that, you’ll see new fields.

First is “Participants Database Field” set that to the name of your “type” selector in your signup form, so that the template knows which field to check.

Next, select an Operator: in this case you want “Equals” because you’re testing against an exact match, as you’ll see.

Now, set up the comparison value. To check the submitted value against a specific string, choose “Comparison Value” and then below that, type in the value that the template will look for. If the applicant is a student, the comparison value might be “student.” If the incoming registration submission has a “type” value that equals “student” then use this template and send the email.

Next, you set up another email template for the teachers. It will be checking the same field, but for the value “teacher.”

Sending an Email When a New Blog Post is Published

If you’d like your list to receive an email when you post something new, use the “Blog Post Published” email action in your template.

You can use several tags in the email to include content from your blog post: [post_title], [post_content], [post_excerpt], etc. The [post_content] tag will include the whole article, including any images. (embedded media such as audio or video won’t work, however) To provide a link back to the post, use the [post_permalink] tag to generate the link. The post featured image can be included with [post_thumbnail].

Set up your “Send on Condition” to only send to those who have elected to receive your mailings. For example, if you have a checkbox for people to opt-in to your list use that as your condition for sending the email…such as in the example to the right here.

This is not a “mass-email” feature, you will be limited to 100 emails generated by this action. See above for the reasons why these limits are in place.

The “Blog Post Published” email action can also be used to send notifications to a plain list of emails also, of course.

SMS Messaging

It is possible to configure an email template to send a message to a cell phone. To do this, you need to know the cell service provider’s SMS Gateway email address. You can usually find it easily with an internet search using your service provider name and “SMS Gateway” Once you know the gateway email address for your phone, just use that as the “recipient” and when the email template is triggered, it will be sent to the mobile phone as a text message.

Of course, this will have no support for formatting and very limited support for images and media, but links will work fine.

It is not possible to send an SMS message if you only know the phone number, you must know the service provider for the number as well.

Product Settings

The Email Expander Add-On does not use a settings page, instead, each template has it’s own configuration.

Email Title

Gives the template a name. If you have several templates, it’s a good idea to use something descriptive here so you can find the template next time you need to edit it. You can change this any time, it won’t affect the template’s function.

Email Setup

Sender Name, Sender Email

The email should be from a legitimate sender so the recipient knows it is not spam. Value tags are allowed.

Recipient Name, Recipient Email

These will often contain value tags so that the email is sent to the person registering. This could also be any fixed email address. The name is optional.

It is possible to send the email to multiple recipients. If you want to include a fixed email address as a CC or BCC (such as to an administrator), there are fields for that below. If you need to send to multiple email addresses using value tags from the record, you can enter those here as a comma-separated list of email addresses, for example: [email],[email_2]

Subject

The subject line of the email, can use value tags.

Email Body Template

The is the main part of the email, you can put HTML, headings, images, styles, etc., but be aware that many email clients have limited ability to render HTML Keep it simple for best results.

Extras

CC, BCC Recipients

Just under the attachments are settings where you can add additional recipients to the email. BCC recipients won’t be visible to other recipients, while CC recipients’ emails will be visible to all recipients. This field does not process value tags, you can add more recipients using values tags in the Recipient Name and Recipient Email fields above.

Attachments

This section allows you to include files with the email. Simply select a file (either from the media library or upload a file) and the user will receive the file when they get the email. You can include multiple files by adding more attachment lines. Remember that any attached files will have to be downloaded by the recipient, so keep it small to avoid problems on the receiving end.

User Messaging

Some actions use this field to show the user a message after the action has occurred, such as after submitting a signup form. This gives you a way to customize the user feedback message according to the email template that was used to send an email.

The Send Configuration

Each email template may have a “Send Action” that determines when the email will be sent. Some of these are automatic, some are manual: waiting for an action by an administrator to be sent.

Signup Submission: the email will be sent when a signup form is submitted. This action duplicates the default action of Participants Database, and so if this template gets used, it prevents the default email from being sent. This means that if you set up a template here that sends on certain conditions, the regular signup email will be sent unless those conditions are met.

Frontend Record Update, Backend Record Update: this action happens when a record is updated. The frontend update happens when a user edits the record after accessing it with their private link, or when the frontend record edit form is used in any other way.

Frontend Record Pre-Submit Update: this action happens just before the updated record is saved on the frontend. This gives you a chance to check for a changed value because you’ll have both the new and old values to check against.

Multipage Record Update Thanks: this email is triggered when a user completes a multi-page record edit form. It requires that the user end up on a page with the [pdb_signup_thanks] shortcode when the final page is submitted.

Admin List “With Selected” Action: this gives you a way to define a custom email that is sent manually to a selected list of recipients by an admin in the backend. If you set up a template with this action, it will appear in the bulk actions dropdown in the Participants Database admin list page so you can send your custom email to the selected members.

Note that this will only send to a limited number of recipients, 100 or less to avoid script timeouts, so it can’t be used to send out to your list of thousands. Also, be sure you know your web host’s mass email policy to avoid problems with your hosting.

Admin List With Selected: delete, approved, unapproved: this action is triggered when a bulk action is performed on the list. An email will be sent to every selected record when this action is triggered.

Send on Condition

This setting gives you a way to determine if the email should be sent. Enable this to have a condition checked before sending the email.

Participants Database Field

This selects the field that is tested. It must be a field that is included in the submission, either as a user input or as a hidden field.

Operator

This gives you several ways to make a comparison to determine if the email should be sent.

Comparison Value Source

When the value in a record is checked, it will be checked against the comparison value. This value can come from one of three places: either as a literal value, against the saved record, or against the current “locale” value.

Comparison Value checks the record value against a set value. This value is found in the “Comparison Value” field below.

Send on Field Value Change Only when checked, will only send an email when the record value is changed to the comparison value. It will not trigger if the comparison value matches, but isn’t getting changed. (this is only available when the comparison source is Field Value to Fixed Value)

Saved Value checks the incoming or new value against the previously saved value. This value is only valid when the trigger is a record update because it requires that the record be in the database beforehand. The purpose of this is to give you a way to check against a changed value, so that the email will only be sent when your selected field value is changed by the user or an admin.

Current Locale Setting: this value is the current language selected. If you have a multilingual site, this gives you a way to send a different email depending on the language chosen. It will be the usual WordPress language abbreviation, usually something like “FR_fr” or “BR_pt”.

Prevent Duplicates

If this is checked, an email that uses the same template going to the same address as an email that was sent in the last 24 hours will be blocked as a duplicate. This is mostly to prevent accidental resending.

F.A.Q.

Can I use this plugin to send a newsletter to the list?

That depends on the size of your list. If it is 100 or less, no problem. If you need to send to more than that, it’s possible (if a bit laborious) to send your newsletter in groups of 100 or less. Be sure you know your web host’s mass email policy, most shared hosting does not allow you to send lots of emails over a short period of time.

If your list is more than a few hundred, you’ll need to use a proper mass-email plugin or third-party service.

Is it possible to keep a log of all emails sent?

You can do this by installing an email logging plugin. I’ve tested Email Log and it works well.

Is it possible to get a notification when a user changes their record?

Yes, use an email template with the “Frontend Record Update” trigger. In the body of the email, you can use the [change_log] tag to show a table with all the changes the user made.

The emails are not sending: I'm getting a "Message body empty" error

This is most likely caused by another plugin that uses the global content filter. Participants Database be default applies the global content filter to the body of all emails so that other plugins’ functionality can be added to the message, usually by using a shortcode. Sometimes plugins alter the body text without any shortcodes.

The fix for this is usually to change the “Use WordPress Auto Formatting” setting in Participants Database (under the advanced tab) to a setting other than to use the global content filter. Be sure to test your email after changing this setting.

I'm getting sharing links or other unwanted content in my emails. How do I prevent this?

This is the same answer as the above question. You are probably using a plugin that adds sharing links or other dynamic content to your site content. You can prevent this from happening by changing the “Use WordPress Auto Formatting” setting in Participants Database under the advanced tab.

I want the recipient of the email to be determined by a selector in the signup form, how can I do this?

Often, you want to be able to send an email to a recipient based on some value in the data submitted by a signup form. You don’t want to just put the email addresses in the form, so how is this possible?

This can be a little tricky to set up, but it’s not really complicated.

The first thing you need to do is set up your selector so that it can save a value that uniquely identifies the recipient. What that is really depends on your application. It could be a name or an ID number…anything that you can use to find a specific email address to send the email to.

Next, you need to use the “value tag” for the selector in the “to” section of your email template.

Then, you set up a filter that takes this identifying information and gets the email address to use: the value tag in the “to” slot is then replaced with the recipient’s email address. The email template has a filter just for this purpose. I have written up a gist that shows you how to filter the recipient value and get your email address:

I have two different signup forms, and I want each form to send a different email. How to set this up?

In a scenario such as this, you’ve typically got two signup forms on two different pages. For each one you plan to send an email for that particular submission.

To do that, we need two things:

First, set both templates to send on the “Signup Submission Thanks” action. (Also: in the Participants Database settings, under the “Signup Form” tab, deselect the default email for the signup form so you won’t get that triggering also.)

Second, we’ll need a way to differentiate the two submissions. The method I describe in this article “Multiple Databases” in Participants Database will work here: set up a hidden field that will be included in the signup form that records the name of the page the signup form is on. This is done by placing post->post_name in the “default” setting for the hidden field.

Back in your email templates, on each one, set up the “Send on Condition” to match the name of the page that corresponds to the template you want that registration to use:

  1. Enable “Send on Condition”
  2. Select “field value to fixed value”
  3. Select the hidden field
  4. Set the fixed value to the name of the page that will trigger the template: this will be different for each one

There are two other methods worth mentioning for determining which template to use: you can set the value of the hidden field in a custom template, or you could give the user a radio button or other selector, and use that value to determine which template is used.

I want to send an email to a group within my list, how do I do that?

OK, easiest way to do this is to define your email template and set it to go out as a “PDb Admin List With Selected Action” Now, go to the admin list page, and use the filter to show only the people you want to send the email to.

Now, all you have to do is select all (checkbox at the top of the column of checkboxes) and then select your email from the “with selected” dropdown, hit “apply”, confirm, and they will send.

You can define several emails like that if you need to send out different ones to different groups.

How do I send an email from another script?

If you have some custom code and you want to use the Email Expansion Kit to send an email, it is very simple. First, of course, define the template you want to use. At the top of the template edit page, you’ll see a numeric ID for the template. You’ll use that to invoke the template in your code.

In your code, use a function like this:

\cpt_email_templates\sender::send( $template_id, $record = array(), $context = '' );

Where $template_id is the numeric ID of the template you want to use.

$record is an associative array of data to use. This would normally be a Participants Database record, but it can be any associative array of data to be used in the template. This is optional, you don’t have tp include data, it is only needed if you want to display the data in the template.

$context is an optional string to name the context of the send, it is only for the purpose of labeling the send operation. This is useful of you are using other filters on the email send process and you want to know the source of the email. The context value will also be added to the header of the email so you can use that to identify the code source of the email.

How do I wrap the email with a DOCTYPE declaration or use an HTML framework for the email body?

This is possible, there is a filter pdb-template_email_html_body that you can use to wrap the body of the email with your HTML framework, or add the DOCTYPE declaration. This can be helpful in addressing layout issues due to inconsistent application of CSS layouts in email clients.

Check this article for more information on that: Which Code Should I Include in Every Email?

Here is an example plugin that shows how this can be done:

Support Discussions for Email Expansion Kit

  • Is there any way of making a template save the messages as drafts rather than actually sending them? This could be useful if some of the messages might need tweaking or personalizing.

    • No, there is no provision for that. The plugin is designed to make the process automatic. If you need different templates for specific circumstances, you can use the “conditional send” setting to select the template depending on the incoming values. Alternatively, if you’ve got some coding skills it is possible to make the behavior of the templates more complex.

      • Thanks for letting me know, Roland. That being the case, I think it will be easier to save the relevant records as a CSV file and use that as the data source for the mail merge extension in Thunderbird, where one can choose ‘save as draft’ as one of the output options.

  • We are a new user of the Email Expansion Kit and are having a problem with Sending Manually. The above documentation says that if an email template has Admin List “With Selected” Action set, we should be able to: “then select your email template in the “with selected” action dropdown”. BTW our add-on says PDb Admin List “With Selected” Action. We are not seeing our email template in the List Participants “with selected” action dropdown”.

    Separately, we need to be able to do this function from the frontend including filtering the PDB list by field and setting the email subject and message. Please share any tips you have that would help me get there more quickly.

    Thank you!
    Jim

    • Hi Jim,

      Not sure why you’re not seeing your email template in the “with selected” dropdown. Make sure the template is enabled at the top of the email template send configuration.

      You won’t be able to use this feature on the frontend list, the code support for that just isn’t there.

      • Where might I send screenshots of the List Participants page not showing our email template and the part of the email template?

        • Email me at support@xnau.com

        • I can get a filtered api list of participants email addresses. Separately with PHP code I can send an email via the PDb_Template_Email function, which I have done. I can combine these and send a programmed email to the list of participants email addresses, which I have not done yet.
          However, I can’t make use of a defined Email Template using passed parameter data and send the Email Templete to that same list of participants email addresses?
          Is this correct?
          Jim

        • If I understand your questions correctly, there isn’t an API method for sending an email to a list of recipients all in one go, you need to do it one email at a time using the PDb_Email_Template::send method.

        • Allow me to correct my previous comment: the method you should use to send an email using one of your email templates is:

          \cpt_email_templates\sender::send( $template_id, $record = array(), $context = '' );

          Where $template_id is the ID of the template. You can use this method repeatedly to send to a list of recipients, but the number of emails you will be able to send will be limited by your php configuration “max_execution_time” setting.

      • Roland,
        \cpt_email_templates\sender::send( $template_id, $record = array(), $context = ” );
        I must be missing something as it is not clear to me how to programmatically use this function. We could use an Email Template, but we still need to get input from the leader of the bocce group for the subject and message.
        I can do it and have done using get_participants with a filter for the bocce group, extract the email address, and then use PDb_Template_Email::send($config, $data); to send the email. Which works.
        It would be better if we could insert a list of email addresses in a ‘cc’ field in the config array. This bypasses the Email Template, but it works.
        Not clear how to use \cpt_email_templates\sender::send( $template_id, $record = array(), $context = ” ); and what is passed in $record and $context?

        • The template can handle that: when you supply the data array “$record” you can include the email title as an additional field in that array…for example 'email_title' => 'Latest News' and then in the template, for the subject line, put [email_title].

          If you use PDb_Template_Email::send($config, $data) you won’t be able to use the defined email template, because that function requires you to supply the template, the former function gets the template using the template ID.

        • Also, all the data you need to send the email is either in the template as a literal value, or in the data array and in the template as a value tag.

  • Is there a way to send an email on multiple conditions?
    I would like to send a template depending on the signup page but don’t want to create a template for each value.
    If not I’ll use a your filter pdb-before_submit_signup so that I can set up another variable to an int for all the pages having the same template but that will force me to update the code for each new page I want to include in that template.

    • Yes, you have to make a separate template for each one, only one condiition per template. I do have plans to make multiple conditions possible, but it’s a big job, not happening any time soon. Custom code can also be used to determine which template to use.

      • No worries the solution to set another value with the filter for those pages works perfectly thanks

  • Hi Roland great plugin
    don’t know if I’m missing it somewhere but is there a way to create an email template to show the payment amount as a shortcode of the payment log as its displayed in the admin record.

    when using the payment field shortcode [pdbmps_payment_log] I only get this in the email but no payment amounts is there a way to include this
    Courses Payment Type
    Foundation Course Offline
    MBA in Public Mng Offline
    MBA in Public Mng Offline
    MBA in Human Resource Mng Offline
    MBA in Human Resource Mng Offline

    Many thanks in advance

    • Im sorry, it’s not possible to include a payment log entry in the email. You can include the payment amount and other values from the last transaction as described here…Value Tags

  • I work with a large non profit that does volunteer management. I’m replacing a third party external system with Participants Database, have used it before and like it a lot. But I need a solution for a specific problem:

    When someone volunteers and completes a signup form they select a specific location to volunteer at (we have about 20 locations). With the present system, it sends an email to the manager at the location that the volunteer selected. Will the email expansion kit allow me to set up a specific recipient (or recipients) for emails based on form submission fields: i.e. – the value in a dropdown of locations?

    • Your questions seems familiar, did you also ask in the WP Participants Database forum?

      Anyway, the solution is to create a custom filter for the outgoing thanks message that looks at the submitted data and changes the recipient accordingly.

      You can use the pdb-before_signup_thanks action for that. Check the linked page for details.

  • I’m having a problem with the [record_link] value tag.
    The email being sent creates a clickable link to the “Membership Record”, but the URL is merely to the /membership-record/ page without the ?pid=PRIVATEID appended….

    Is there something I missed in the setup of things somewhere?

    >>>Michael

    • Check the plugin settings under the Record Form tab, make sure the “Participant Record Page” is configured.

      • It is defined there, and I can get to the /membership-record/ page.

        The URL sent it the email where I use the value tag [record_link] doesn’t add the ?pid=##### part. If I manually add that to the end of what the link brings up, it works as expected.

        Should the [record_link] value tag be providing the full URL including the GET data part?

        • Actually, let me update that…. This is what gets added to the email:

          p class=”alert alert-error” No record was found. /p
          blockquote class=”wp-embedded-content” data-secret=”7bi4NbO1Wt”
          a href (the url) Membership Record /a /blockquote

          (altered because your site thinks I’m spamming… but I’m sure you’ll get the concept)

        • That looks like you have a [pdb_record] shortcode in your email template where it says “No record was found.”

          As to the link not forming correctly, that is curious…are you using the “Pretty Permalinks” add-on? Maybe some other plugin installed that might alter links?

        • I don’t seem to be able to reply to the most recent comment.

          I have tried again after disabling all my plugins other than the PDB ones. Still having the same issue.

          Tried messing with permalinks. nothing there either.

          If I send the “edit link / password recovery email” it sends the link just fine.

          May I ask, the link supposed to be opened by the PID being added to the URL, or by the data-secret field that’s added to the href and p tags?

        • The “data secret” field is not something that Participants Database is doing, I don’t recognize that code. One thing you can do is try using a simplified template for the “signup response” email template to try to isolate the issue. For example:

          Thank you, [first_name], for signing up.

          You may complete your registration with additional information or update your information by visiting this private link at any time: <a href="[record_link]">[record_link]</a>.

          It’s important to understand that the body of the email is passed through WordPress’ global “the_content” filter, which adds the auto paragraphs formatting, and also makes it possible for other code to interact with the body of the email. You can control this by changing the “Use WordPress Auto Formatting” setting found in the main plugin settings under the advanced tab.

    • When I turn off the WordPress Auto-Formatting, it all works properly.

      I’ll stop bugging you know and see what I need to figure out on that end (or just leave it this way!)

      Thanks for indulging me.

      >>>Michael

  • Hi Roland

    I am trying to test the triggering of emails when a participant’s payment status changes from “Paid” to “Payable” (which I have left as the default 14 days) with no success so far. However, before flagging a possible issue I want to clarify (1) what format do you use for typing in the “Testing Date” and (2) what date should be typed in, eg if Due date is October 14th, 2021, do I use October 1st, 2021 as the testing date or November 30th, 2021 or November 29th, 2021?

    Thanks,
    Peter

    • This is discussed in the Plugin FAQ.

      It can be tricky testing this particular action, but here is the method I use. First, it’s important to know that the status of a record is checked in the background using a “cron” which in the case of WordPress depends on site traffic. A site that is getting no or very little traffic will often not trigger the cron in a timely fashion.
      (there are ways around this) You can use a plugin like WP Crontrol to check that the cron is set and also to trigger it manually.

      The status of a record is also checked when a record is updated, so you can use that action to see if the switch from paid to payable triggers the email.

      Whether it triggers something or not this event will be logged. Remember that the initial status must be paid, this action is not is triggered if the initial status is any other value.

      So, the way the testing date works is you set the testing date to the date you want to test. If the record you’re testing is going to go to “payable” on a specific date, you should set the testing date to that date or the next day. When the cron is run manually or the record is updated, the status check will behave as though the testing date is the current date. The testing date does not work when the cron is triggered automatically.

      Also very important: your site must have WP_DEBUG switched on in order for the testing date to be active.

      The date you enter should be in an easily-parsed format such as “Oct 27, 2020” or “27 Oct, 2020” Using a numbered month risks an incorrectly-parsed date. Don’t use ordinals, such as you have in your examples.

  • Hi Roland, just bought the Mail plugin but after installing it no settings tab in Settings menu is shown.

    Am i missing something?

    Regards, Marco.

    • Found it! Sorry for the post!

    • I’lll answer for the benefit of others.

      The email expansion kit has no global settings, it is a way to define email templates. These templates show up in the admin menu as “PDb Email Templates” and each template you define has its own settings.

  • Email failed to send. This is the error I’m getting when I try to send an email to one contact in the Participants Database listing using the Email Expansion kit.

    I have WP Mail SMTP installed and it is sending email correctly.

    I turned on the Participants Database debug log for the test:

    Log file initiated at: September 1, 2020 5:26 pm UTC
    [09/01/20 5:26pm UTC]
    PDb_List_Admin::initialize
    list query: SELECT * FROM wpyi_participants_database p WHERE p.caffeinated = ‘Attendee’ ORDER BY p.date_updated desc LIMIT 0,50
    [09/01/20 10:27am PDT]
    cpt_email_templates\conditional::check conditional: Array
    (
    [0] => Array
    (
    [data_value] => Attendee
    [operator] => =
    [comparison_value] => Co-Spnsor
    [logic] => AND
    )

    )
    [09/01/20 10:27am PDT]
    cpt_email_templates\conditional::check test result: bool(false)
    [09/01/20 10:27am PDT]
    PDb_List_Admin::_process_general
    action: pdbcptet-admin_list_with_selected_403
    [09/01/20 10:27am PDT]
    PDb_List_Admin::initialize
    list query: SELECT * FROM wpyi_participants_database p WHERE p.caffeinated = ‘Attendee’ ORDER BY p.date_updated desc LIMIT 0,50

    What am I missing, I am currently only trying to send to 1 record in the list.

  • Hi,

    Thanks for this excellent plug-in and the email expansion kit. I was hoping you could help me with a bit of coding I’m stuck on.

    I’m trying to set up a two-part action in the Admin list that when selected will
    1 – update the status of the selected records
    2 – send an email to them using a pre-defined template.
    I’ve created the first part of the action using code that you had posted but am not sure how add the second part using an email template.
    Do you have any code you can share for this?

    Thanks,
    Tim

    • Yes, you can send a templated email from your code. In your code, use a function like this:

      \cpt_email_templates\sender::send( $template_id, $record = array(), $context = '' );

      Where $template_id is the numeric ID of the template you want to use.

      $record is an indexed array of data to use. This would normally be a Participants Database record, but it can be any associative array of data to be used in the template. This is optional, you don’t have to include data, it is only needed if you want to display the data in the template.

      $context is an optional string to name the context of the send, it is only for the purpose of labeling the send operation. This is useful of you are using other filters on the email send process and you want to know the source of the email. The context value will also be added to the header of the email so you can use that to identify the code source of the email.

Leave a Reply to Michael Schnell Cancel reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.