Commit a2586e5d authored by ErikHommel's avatar ErikHommel

wip emailprefs example

parent 37aa1d0f
# Example of email preferences form
As the combination of the **Form Processor** extension and the **Action Provider** extension really is a framework it is relatively easy to develop your own actions.
This could be necessary because:
* the current set of actions is limited to what we needed initially and it could well be that you need an action that is not there but will be very useful to others as well.
This probably means you want to develop a new action in the **Action Provider** extension (with a pull request).
* you need to develop a very specific action which is only meaningful for the organisation/project you are working with.
In this case you will probably create your specific action in your own extension.
!!! Note
The **Action Provider** is a separate extension rather than part of the **Form Processor** because it can also be used by other extensions (at the moment the [Data Processor extension][dataprocessor]).
This example includes developing specific *action* and *retrieval criteria*.
## What result do I want?
I would like to have a form on my website where a contact can specify his or her email preferences.
The idea is that we include a link in each mailing or mail we send out with a checksum (see the wonderful [AGH Strategies Email Link Guide][aghcheckusm]).
This link should lead to the form (prefilled if we know the person) which should look like this:
![Mockup Form](/images/emailprefs-mockup.png)
Once the person has ticked all their boxes the result should be processed into CiviCRM.
In CiviCRM I will have a few groups:
* a group called Monthly Newsletter
* a group called Monthy Actions
* a group called Yearly Summary
The email preferences should reflect this group membership:
* if someone ticks the box *I do not want any general mails* the contact should be removed from all three groups
* if someone ticks the box *I would only like to receive the yearly summary* the contact should be removed (if a member) from the groups **Monthly Newsletter** and **Monthly Actions** and added (if not a member already) to the group **Yearly Summary**.
* if someone ticks the box *I would only like to receive the monthy newsletter* the contact should be removed (if a member) from the groups **Monthly Actions** and **Yearly Summary** and added (if not a member already) to **Monthly Newsletter**
* if someone ticks the box *I would like to receive the monthly newsletter and the monthly action summary* the contact should be removed (if a member) from the group **Yearly Summary** and added to (if not a member already) to the groups **Monthly Actions** and **Monthly Newsletter**
The same rules apply when retrieving the current preferences.
!!! Note
The assumption is that the form will be developed in such a way that I can not receive conflicting ticks!
## What do I need to do?
## Develop my action to retrieve the current email preferences
## Develop my action to save the new email preferences
## Add my actions to the Action Provider
## Set up the form processor
## Set up the form
## Result!
[dataprocessor]:https://civicrm.org/extensions/data-processor
[aghchecksum]:https://aghstrategies.com/content/how-create-one-click-personalized-links-civicrm-emails
......@@ -29,9 +29,10 @@ The basic concepts of the **Form Processor** are explained on:
In this guide you will also find an example to set up forms with the **Form Processor** without coding and an example how to develop your own *actions* and *retrieval criteria*, as well as an introduction on how to create your own:
- [How to create a basic form to sign up for a newsletter](sign-up-newsletter.md)
- [Introduction to creating your own](create-your-own-introduction.md)
- [How to create a form for your email preferences](email-preferences.md)
The latter How To will give you an example of how to develop your own actions!
## CiviCRM versions
The **Form Processor** extension has initially been developed with CiviCRM 4.7.4 and has been tested with CiviCRM 5.x on various sites.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment