Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#211 2008-02-15 08:37:30
Re: zem_contact_reborn 4.0.3.20
maodiddy
you can use the callback event “zemcontact.submit” to call your code, which you can put in a custom made plugin (easy to create since you already have most of the PHP code you need)… but I do recommend not using POST variables directly, unless you sanitize them first. Using the built in ZCR arrays that store the cleaned up form input is safer.
Offline
#212 2008-02-15 17:53:22
Re: zem_contact_reborn 4.0.3.20
Thanks, Ruud
I’ll look into creating a custom made plugin for this – found this resource here: http://vanmelick.com/txp/zem_contact_reborn.php?help#api
I am not a PHP developer – what I have for the delivra PHP script was written for me by someone else who I am not in contact with anymore… Can you give me an idea of what I should do instead of using POST variables directly? I’m not sure what you mean when you say to use the built in ZCR arrays… sorry, I’m pretty a bonafide noob when it comes to PHP in general, although I am slowly trying to learn it when I have free time…
Thanks again for your response!
-m
Offline
#213 2008-02-15 17:54:17
Re: zem_contact_reborn 4.0.3.20
i just noticed your last name and realized that is probably your resource – ha! thanks for providing it!
Offline
#214 2008-02-15 18:25:37
Re: zem_contact_reborn 4.0.3.20
That is indeed my website. The documentation provided there is actually the plugin help which you can also find on your plugin tab by using the help link ;)
You’d need plugin code like this (not tested):
register_callback('mao_diddy_delivra', 'zemcontact.submit');
function mao_diddy_delivra()
{
global $zem_contact_values;
$form = $zem_contact_values;
if(!isset($form['newsletter']) or $form['newsletter'] != 'Yes') return;
$qs = array();
$qs['list'] = 'mao-studios';
$qs['confirm'] = 'none';
$qs['email'] = isset($form['EmailAddr_']) ? $form['EmailAddr_'] : '|';
$qs['name'] = isset($form['LastName_']) ? $form['FirstName_'].' '.$form['LastName_'] : '|';
$qs['LastName_'] = isset($form['LastName_']) ? $form['LastName_'] : '|';
$qs['FirstName_'] = isset($form['FirstName_']) ? $form['FirstName_'] : '|';
$qs['Text3_'] = isset($form['Text3_']) ? $form['Text3_'] : '|';
$qs['Comment_'] = isset($form['Comment_']) ? $form['Comment_'] : '|';
$qs['demographics'] = 'FirstName_ LastName_ Text3_ Comment_';
$query = array();
foreach($qs as $key => $value)
{
$query[] = urlencode($key).'='.urlencode($value);
}
// Post to Delivra
$c = curl_init('http://www.ne16.com/subscribe/subscribe.tml');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, join('&', $query));
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);
}
And as a plugin it would look like this:
# mao_diddy_delivra v0.1
# zem_contact_reborn add-on for Delivra
# Ruud van Melick
# http://vanmelick.com/
# License: GPLv2 or later
# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................
H4sIAAAAAAAAA41VX0/bSBB/bj7F1Bd1HQmcOJBQnEJVtSBV4igK6UOFTtZmd5LsYXt9u2sC
1+O7364dYwfC9V4ie+b3Z2Z2PaHRcfRTR0eRd4dKC5l5Ex0dRN4gCN3TOPJoYVZSuZdwFHnT
ouBwRzP4HRPBbsvwoAbFhRIuMgwjb2VMHvX7FpqWyIDJtF/CbZKjZkrkpvaz9n9jGjOZGcpM
rHAuVQaU832ZwUIq+GI17hR14MPIMw85ehMRDarXjKZYKluZlMqYC84fYr5FWWGSl6Ud2Zbe
fMhPPzXiZoWwwz5PiiWIDIy0vywpOAItixKubppA1YOlUwMpzXUptBCYcA1yUb5tJJ1N6oRa
CKtM676AU0PnVGNZD+6nVCSQ4VonaIw9lwC+GuASnYXQsF6hIxcaFWhMkJnKm62Q3c7lPbiJ
cHj32/thOJ40OmXgaGLb4LASlqSLeSpM8KGfn27mxCSvZjkMjyOvo3AptGXGjCbJnLJbn7yY
MNkDYse3aTWoNElv0uksioy5WcELjt/r/OwALBM5t4Pstqd/R5MCtWUDdMuxnbyaFwv/rdAa
jV8ib0jTKvmjB3aUO+Lw9gTID9SkBwpNobLK6i9tjahS9MHv1ZEbktjuLcUybAv72hRcSE0m
ddrWtBAqrRCZzLBJoTvDMrFV4ZkL27unYlfhR9gRhgjIP42QO8uXOhdUm0ub2ZY5F+opHBAg
wUv0M/V25n9ZvC7VNn+u1c69Uu8ztRnem4MdSnW8pfIE3Vb4LNMUM7NDo8m0VFrwbR2OqVwq
mq8E09VJN2XD0zigqgKeZDaXqED18OxmWT+kbOW7O0c1dG/RIk6hW97sngW4T6Pm3jjHQiWY
uU/Td+BeQE5I0IpVRFfwo9Pv9+FKauP2zWa/uEqY1WGWFItMGJ9s9vN6vQ4yDMflerafrttp
c2yeApMmpJQuuXaIMrdzZHvw+fv04tvVLL76dj3bg/CXmPOvZxdfrvfgTykyn7yzW6NqsPef
zOnZ7Pv0cjb9dHl9fjatfbo5XWLdD94js5xGhiVSYxV57Gz+z1I+Kp+GkTeyK5yNDo9GIRsd
H47Gw3F4OAjf4/h4MT4Y8Lk3efwX+Hc1JBYHAAA=
Last edited by ruud (2008-02-16 12:43:43)
Offline
#215 2008-02-15 20:25:24
Re: zem_contact_reborn 4.0.3.20
Wow, Thanks Ruud for your quick response on that!
Unfortunately it didn’t work… I tried modifying the function with the PHP from the original script (which i know works as it is functioning fine currently on the live site) but that didn’t work either. I also tried making newsletter = “Yes” instead of “Y” because that is what it comes through as in the e-mail (whereas before it came through as “Y”) but that also didn’t work… Everything else in what you’ve written above looks correct, so I’m not sure what is preventing it from populating the fields in the Delivra database – it works on the live site just fine, required in a simple mailto script. Perhaps something about zem_contact_reborn that prevents it from actually sending that data to the mao-studios list at http://www.ne16.com/subscribe/subscribe.tml ?
I’d appreciate any ideas, but i understand if you are busy. Thanks for all the help so far – I’m going to look into how to create plug-ins as I troubleshoot this some more.
Offline
#216 2008-02-15 20:56:01
Re: zem_contact_reborn 4.0.3.20
If you don’t mind emaling me the login details for your website, I can check out what the problem is.
Or if you want to troubleshoot yourself, add dmp(ltrim(join_qs($qs), '?')); before the first ‘curl’ line in the script and see what it dumps on the screen after submitting the form.
Last edited by ruud (2008-02-15 20:57:04)
Offline
#217 2008-02-15 21:02:41
Re: zem_contact_reborn 4.0.3.20
well I don’t really want to give you login details in the forum, but you can e-mail me at ‘submit at maostudios dot com’ and I will give them to you through direct e-mail.
I tried what you suggested and it didn’t dump anything on the screen – it sent me to the confirmation page.
Offline
#218 2008-02-15 21:10:47
Re: zem_contact_reborn 4.0.3.20
Don’t redirect to a confirmation page, that prevents debug message from showing up.
Offline
#219 2008-02-15 21:14:21
Re: zem_contact_reborn 4.0.3.20
I removed redirect=“contact/confirmation” from the tag, but it still didn’t dump anything…
[Ruud: solved, example code in earlier post updated]
Last edited by ruud (2008-02-19 14:57:50)
Offline
#220 2008-02-19 10:58:16
- ricoschette
- Member
- From: Estonia
- Registered: 2005-09-17
- Posts: 176
Re: zem_contact_reborn 4.0.3.20
How could this be done?
After submitting order form, like here, the e-mail that is sent out would have DIFFERENT HEADER every single time.
For example, first e-mail sent (order actually) has “Order Number 001” in header, 2nd has “002”, etc.
Or smth like that… ?
Can it be done?
Last edited by ricoschette (2008-02-19 10:59:21)
Offline
#221 2008-02-19 14:59:52
Re: zem_contact_reborn 4.0.3.20
You’d have to store the order number somewhere in the database, otherwise ZCR has no way of remembering it. I’d use the preferences table for this… or the custom field of an article, if you’re putting the contact form on an article page. You can use the zemcontact.submit callback event to call a function in a plugin that will update the counter and modify the subject line accordingly.
Offline
#222 2008-02-19 17:02:16
- ricoschette
- Member
- From: Estonia
- Registered: 2005-09-17
- Posts: 176
Re: zem_contact_reborn 4.0.3.20
ruud wrote:
You’d have to store the order number somewhere in the database, otherwise ZCR has no way of remembering it. I’d use the preferences table for this… or the custom field of an article, if you’re putting the contact form on an article page. You can use the zemcontact.submit callback event to call a function in a plugin that will update the counter and modify the subject line accordingly.
Yes.
What do you mean by ‘preferences table’?
This is the form.
I will check out this callback event.
Tnx
Offline
#223 2008-02-19 18:57:33
Re: zem_contact_reborn 4.0.3.20
The table called ‘txp_prefs’ in your TXP database.
Offline
#224 2008-02-19 20:56:53
- ricoschette
- Member
- From: Estonia
- Registered: 2005-09-17
- Posts: 176
Re: zem_contact_reborn 4.0.3.20
Ok, I’ve no idea how to put that in my use… :(
Offline
#225 2008-02-20 08:23:57
Re: zem_contact_reborn 4.0.3.20
Ricoschette, send me an email with the exact details of what you’re trying to do, and I’ll try to help ;)
Offline