1

I'm wondering if the following is possible within CraftCMS and suggestions for making it happen?

We have two Member groups (Customers and Contractors). When a Customer makes an enquiry they complete a series of pre-set questions. These pre-set questions are used to filter individuals from the Contractors group.

On submission the Customer receives a notification email with a link. Admin also receives a notification with the same link.

The link takes the customer to a page which displays:

  • Customers own submitted information and responses to the pre-set questions.
  • Same page also displays a list of matched Members from the Contractors group who fulfil the criteria which is matched using the pre-set questions fields.

Customer can then decide which contractor they wish to work with.

Customer clicks "Hire" and an email is sent to the selected Contractor. Email contains the Customers contact details.

Any help/advice is very much appreciated.

Martin

1

This is definitely possible. While certain features can be done with a custom module, my answer will focus on using Sprout Email as that plugin makes it easier to give your users more control in the email management workflow.

Sprout Email comes with several Notification Events. For example, when your customer submits their inquiry form you could configure a Notification Email to watch the 'When an Entry is saved' event and trigger an email to your customer or an admin or both. You can configure more than one email to the same event. In this example I'm assuming your form is a front-end Entry Element. However, if you're using Sprout Forms, Sprout Forms comes with a 'When a form entry is saved' event and Sprout Email has a Custom Notification Event API so it's possible to add support for other scenarios as well.

By default, the Notification Events are fairly simple. But if you need to be more specific than 'When an entry is saved' from a particular section you could further limit the scope of when the event is triggered using the Send Rule setting to, say, check if the author of the entry is in one of the particular groups you want to send to.

While there are simple default templates to get you up and running quickly, the Notification Emails sent are completely customizable via Email Templates and you can include personalized data in your email from the data available to the event you are triggering.

This means you can include whatever link you need in your email and whatever info you want to share that was submitted from the form such as the person's name in a 'Dear So and So' part of the message or all of the submitted responses so they can have them on record as well.

The link you include in the email could be constructed dynamically and include an ID or some other reference in it so that when the user clicks, you can look for that ID, validate the user, and pull in the submitted information or other info onto the results page. All of that will happen outside of Sprout Email and directly in Craft just as any other page. The only thing provided by the email integration for these features is the ability to construct the link in the email with the appropriate info so that you have what you need to do what you want to do.

In the case where the customer clicks "Hire" there may be a couple of events to consider. For one example, let's say when the customer hit's hire you trigger a re-save Entry event where you update the submitted Form and mark a lightswitch field to true. Again, you've triggered a Save Entry event and you can use the 'When an Entry is saved' Notification Event to trigger an email. In this case, you may want to limit the Notification to be triggered only when the Send Rule validates and finds that your 'hired' lightswitch setting is set to true.

To mention one other feature, you can also enable Sent Email tracking in Sprout Email. If you do, Sprout will record each email that was sent and capture who it was sent to, the HTML of the email that was sent, and some other metadata. If a user ever reports they did not receive a message you can check the Sent Email history and you have the option to review or resend Sent Emails.

| improve this answer | |
  • Very comprehensive thank you. I guess the only bit not completely covered off is whether Craft can match members from 'Contractors' based on the 'Customers' pre-set responses and then display JUST those contractors on the results page? – Martin Feb 4 at 17:19
  • Sprout Emails 'Send Rule' setting can handle any logic that you can do in a Twig template. So if you could write it as Twig code and get the template to return the text value "true" or "false", you could use the Send Rule setting to do that. If you have a scenario that gets too messy in Twig, you can create a Custom Notification Event using PHP. – Ben Parizek Feb 4 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.