Posted on by

Sending a Signup Notification to a Custom Recipient

This tutorial explains how to set up your Participants Database signup submission notification so that the email goes to a different recipient based on a value in the submission.

In this example, the person filling out the signup form is going to make a selection in the form (let’s say with a radio button) that determines what “kind” of signup it is. When the signup is submitted, a notification email will be sent to a different recipient based on which selection the person made when filling out the signup form.

It is possible to use a similar setup to to determine the notification recipient based on any value in the submission. For example, the value of an address field to route the email according to where the person signing up is located.

Another possibility is that you have multiple signup forms on your site, but each one is for a different thing. In this case it’s a good idea to set up a Dynamic Hidden Field that captures the name of the page the signup form is on. You would then use the value in that hidden field to determine who gets the notification.

Setting up the Selector

For this example, we are using a radio button field to give the person signing up a way to select the “type” of submission it is. That field could be configured like this:

Configuration of the “Department” selector

Customizing the Plugin

In the plugin example I provide below, there are several things you will want to customize for your particular purpose. First, you need to provide the name of the field that will be used to determine what the recipient will be.
In our example, it is the name of the “department” selector field that is included in the signup form.

If you’re using the address example, it might be the “city” or “country” field. For the example of a different recipient for different signup forms, the name of the hidden field you set up.

Routing the Notification

When the submission comes in, you will be using a value in the routing field to determine the recipient. The example uses a “switch” structure to do a different thing for each possible value. The switch makes it very easy to set up your routing. For example, both “sales” and “returns” are going to the same person, while the other selections each have their own recipients.

Importantly, we set up the fallback value before the switch so that if the submitted routing value does not match any of the specified selections, the notification will at least go to someone. This will be the notification recipient as defined in the template or settings.

Setting up the Recipients

In the switch statement, you can clearly see how we match the submitted value, and the set the recipient according to that match. We set the recipient value using the standard “Name <email>” format in our example, but you can also just put in the email address.

The Example Plugin

Here is the code for our example plugin. It should be easy for you to modify this to your purpose, I tried to explain each thing it does and how you can change it.

For more advanced customizations (a lot is possible here) read the section on using the pdb-before_signup_thanks action to customize other aspects of the thanks messaging that happens after a signup submission.

Not sure how to use this code? Read: How to Install a WordPress Plugin from a Gist

7 thoughts on “Sending a Signup Notification to a Custom Recipient

  1. I want to use the Participants Database plugin to registrate and edit members not by the member itsself but by an admin-user in the frontend. Making listing is possible, editing member-data in the frontend is also possible by the edit_link, but signup central in the frontend is not yet possible.
    I need to use the WP User Profile plugin for lineup the data with wp_users necessary for login on the website by the participant.
    What can I change to let using the signup-form not by the new member but by an admin-user in the frontend? I am almost ready to configure the PDb plugin to my needs. This is the last step. Hopefully it is possible.

    1. The plugin is not designed to be administered from the frontend, so while you can do some of those things, you will be saving yourself a lot of work and problems to solve by letting your administrators use the backend interface.

  2. Oke. I maked a mistake. I tested the page when I was logged on on the website. When I logged out I get the empty form. This problem solved.
    I have still one other problem:
    How can I change the layout of this form. I want to change the row-height. How to do it?

  3. To add a new participant I want to use the sigup form in the frontend instead of in the backend / dashboard. So not by the participant himself, but by our central member administration.
    What do I need to adjust to achieve this?

    1. You don’t need to do anything special, just use the signup form to create new records. You can add additional fields to the form, as explained in the documentation.

      If you want to restrict access to the form, you can do that in several ways, such as making the page private. This is something WordPress will do, the plugin doesn’t control access to the forms at all.

      1. I am logged in as privat-user with access to my configured signup-form. When I want to use the signup-form I get the message: “You already have an acount”. So, I dont can use this form in this way.
        What can I do?

        1. This is because you have the WordPress User Profile plugin configured to create a new WP user on signup. So, if you’re logged in, you won’t see the form because you already have an account. The settings give you a way to customize the message the user sees in that case so they won’t be confused.

Leave a Reply
You have to agree to the comment policy.

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

7 thoughts on “Sending a Signup Notification to a Custom Recipient

  1. I want to use the Participants Database plugin to registrate and edit members not by the member itsself but by an admin-user in the frontend. Making listing is possible, editing member-data in the frontend is also possible by the edit_link, but signup central in the frontend is not yet possible.
    I need to use the WP User Profile plugin for lineup the data with wp_users necessary for login on the website by the participant.
    What can I change to let using the signup-form not by the new member but by an admin-user in the frontend? I am almost ready to configure the PDb plugin to my needs. This is the last step. Hopefully it is possible.

    1. The plugin is not designed to be administered from the frontend, so while you can do some of those things, you will be saving yourself a lot of work and problems to solve by letting your administrators use the backend interface.

  2. Oke. I maked a mistake. I tested the page when I was logged on on the website. When I logged out I get the empty form. This problem solved.
    I have still one other problem:
    How can I change the layout of this form. I want to change the row-height. How to do it?

  3. To add a new participant I want to use the sigup form in the frontend instead of in the backend / dashboard. So not by the participant himself, but by our central member administration.
    What do I need to adjust to achieve this?

    1. You don’t need to do anything special, just use the signup form to create new records. You can add additional fields to the form, as explained in the documentation.

      If you want to restrict access to the form, you can do that in several ways, such as making the page private. This is something WordPress will do, the plugin doesn’t control access to the forms at all.

      1. I am logged in as privat-user with access to my configured signup-form. When I want to use the signup-form I get the message: “You already have an acount”. So, I dont can use this form in this way.
        What can I do?

        1. This is because you have the WordPress User Profile plugin configured to create a new WP user on signup. So, if you’re logged in, you won’t see the form because you already have an account. The settings give you a way to customize the message the user sees in that case so they won’t be confused.

Leave a Reply
You have to agree to the comment policy.

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