Textpattern Forum

You are not logged in. Register | Login | Help

#1 2011-09-22 16:41:55

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 204
Website

zem_contact_reborn data to db

Hello,
a client of mine asked me if I can put all the values he receives, as plain text email, into a db table.
Does anything like this already exist?

Thanks

Offline

#2 2011-09-22 18:10:10

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,498
Website

Re: zem_contact_reborn data to db

Write a plugin that hooks into the zemcontact.submit callback_event.

Offline

#3 2011-09-22 20:19:04

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,134
Website

Re: zem_contact_reborn data to db

Hi Manaus

I did a little plugin that do the trick like ruud advised you, the plugin have a zemcontact.submit callback, it store information in textpattern table (you can adapte it like you want).

Hope that help you.

Cheers

YToxMTp7czo0OiJuYW1lIjtzOjEzOiJkemRfbWFpbHZlcmlmIjtzOjY6ImF1dGhvciI7czoyNjoiTWVzc2FvdWRpIFJhYmFoIChEcmFnb25keikiO3M6MTA6ImF1dGhvcl91cmkiO3M6MjE6Imh0dHA6Ly9pbmZvLml4LWR6LmNvbSI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAuMSI7czoxMToiZGVzY3JpcHRpb24iO3M6NDM6IkNoYW5nZSBtYWlsIGNvbnRlbnQgYW5kIHN0b3JlIGRhdGEgb24gdGFibGUiO3M6NDoiaGVscCI7YjowO3M6NDoiY29kZSI7czoxOTgxOiIvKioNCglSZWdpc3RlcnMgdGhlIGNhbGxiYWNrLiBkemRfbWFpbHZlcmlmX2Z1bmN0aW9uKCkgaXMNCglub3cgbG9hZGVkIG9uICd6ZW1jb250YWN0LnN1Ym1pdCcgZXZlbnQuIFlvdSBjYW4gZmluZA0KCXRoZSBjYWxsYmFjayBzcG90IGZyb20gWlJDJ3Mgc291cmNlIGFuZCB3aGF0IGl0IGNhbiBvZmZlci4NCiovDQoNCnJlZ2lzdGVyX2NhbGxiYWNrKCdkemRfbWFpbHZlcmlmJywnemVtY29ud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LiRteWlkLicmbXl2ZXJpZj0nLiR1aWQuJyc7DQogICAgICAgICAgICAkemVtX2NvbnRhY3RfdmFsdWVzW21vbnRhbnRdID0gJG9ubHludW1iZXJzOw0KICAgICAgICAgfQ0KDQp9IjtzOjQ6InR5cGUiO3M6MToiMCI7czo1OiJvcmRlciI7czoxOiI2IjtzOjU6ImZsYWdzIjtzOjE6IjAiO3M6MzoibWQ1IjtzOjMyOiIxNzg1NTA2OTE1ZDRkYzZhMGQyZDEzODQyNDRjZDIwNCI7fQ==

Offline

#4 2011-09-22 21:39:54

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,037

Re: zem_contact_reborn data to db

Rabah, this looks incredibly useful! Thanks for sharing :)

A little pseudo language pack in order to better understand “what goes where”:

nom = name
montant = amount
organisme = enterprise
dons = donation
lien = link
Cliquez sur ce lien pour valider votre don = Click this link to verify your donation

Is my translation tolerably correct?

What are you doing with “vowels”, Rabah, is this for removing dots and commas from the amount of donation?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2011-09-22 22:08:54

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 204
Website

Re: zem_contact_reborn data to db

Shukran Rabah!!!!! :) (and thanks to you too guys)!

Offline

#6 2011-09-23 08:21:25

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 204
Website

Re: zem_contact_reborn data to db

Sorry Rabah, I tried to test the plugin you wrote, but on pasting and running it Txp returns ‘invalid or empty plugin’

Offline

#7 2011-09-23 08:55:20

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 1,898
Website

Re: zem_contact_reborn data to db

I had that too but in the end it seems double/treble-clicking the textarea didn’t select the entire text. Try patiently highlighting the entire string from beginning to end – it does work.


TXP Builders – finely-crafted code, design and txp

Offline

#8 2011-09-23 11:19:56

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,134
Website

Re: zem_contact_reborn data to db

uli a écrit:

Rabah, this looks incredibly useful! Thanks for sharing :)
A little pseudo language pack in order to better understand “what goes where”:

nom = name
montant = amount
organisme = enterprise
dons = donation
lien = link
Cliquez sur ce lien pour valider votre don = Click this link to verify your donation

Is my translation tolerably correct?

What are you doing with “vowels”, Rabah, is this for removing dots and commas from the amount of donation?

Yes uli that right for vowels. and the translation is correct, the link is created to have have a validation link, you are not obliged to use it, just remove it from the code plugin, because tha validation itself is managed by this code :

<txp:adi_gps quiet="1" />
<h2>Validation de votre don</h2>
<txp:smd_query query="SELECT * FROM textpattern WHERE ID='?mid' AND custom_3='?myverif'">
<txp:smd_query query="UPDATE textpattern set Status='4' WHERE ID='?mid'" />
<p><b>Votre promesse de dons a été validé</b><br />Merci</p>
<txp:else />
<p><b>Valeurs erronées</b></p>
</txp:smd_query>

The purpose of the plugin is to store donations made by users in articles, but make the article in hidden mode, then send a mail with a validation link to validate de donation!

Here this a link to download the pluggin:

dzd_mailverif

Remember it s only a littlte plugin that extend zem_contact_reborn to store the form into DB.

Cheers

Last edited by Dragondz (2011-09-23 11:22:09)

Offline

#9 2011-09-23 13:08:10

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,037

Re: zem_contact_reborn data to db

Thanks for placing the smd_query part at our disposal, Rabah. I guessed something was incomplete but stopped thinking about it ;)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2011-09-23 15:43:05

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,134
Website

Re: zem_contact_reborn data to db

I did the plugin for the website darnadz.com, i havent make it availabe because it made only to feet that need, but i think it can serve like an example code for others.

Happy to see that little code (the original plugin template is tooken from ruud if i remember corrcetly) can help someone.

Offline

Board footer

Powered by FluxBB