Textpattern CMS support forum
Nominate a charity, store the results, plus…
Instead of sending physical gifts for Christmas, my client wants to donate to charities.
Around 500 emails will be sent to their clients, including a link to a new section on their website where these clients:
- enter their details (or have these fields already filled out for them)
- select their nominated charity (about 5 of them)
- submit saves the details somewhere
My client wants to:
- view the results in so they can track who has or hasn’t actioned their nomination.
- be able to see the result total for each charity
They also want to ensure that only the true recipients are the ones who can use the form.
Any advice as to how best to proceed?
- Stef’s smd_access_keys will likely be useful
- mem_form immediately came to mind, but I’ve never been able to grok how it works.
- Could TXP comments be coerced to doing what I’m after?
Last edited by giz (2020-08-06 19:51:28)
Re: Nominate a charity, store the results, plus…
com_connect is also a contender. When the visitor fills out the form, you could get an email to be fired off to an admin account (so they have a record of the nomination) but also you could (ab)use the thanks_form to do something clever with a little tag magic.
Instead of simply using the form to display some “Thanks for your vote” message, you have the entire Txp world at your fingertips for that instant. You can call other tags before displaying the message (etc_query perhaps?) to insert stuff into a database table of your choosing. The low-tech solution could then be to export that table to an Excel spreadsheet/CSV so you know who clicked what.
If you wanted to ensure that only nominated users accessed the form, yeah, smd_access_keys would help. You could make a single key that governs the entire page and hope that nobody shares the link with the key in it. Or if you have a way to tie the key generation in with the CRM that sends out the invites, you could get it to call a Txp section that has a single smd_access_key tag in it to generate a key per email address and insert it into the DB.
Add that token to the generated URL that accesses the form and you’ll not only know it came from a legit source, you could also set it to expire after a number of uses (to cater for the fact that people might resubmit the form if they screw up something or miss a field).
Perhaps when the com_connect thanks_form is rendered, if you pass forward the token in a hidden field, you could set that token to expire at that moment so it cannot be used again.
Depends how paranoid you want to be!