Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#205 2008-02-13 21:51:59

simsim
Member
Registered: 2006-05-06
Posts: 70

Re: zem_contact_reborn 4.0.3.20

^^ Anyone?

Offline

#206 2008-02-13 22:11:29

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

The ‘send article’ link is nothing but a link to the page itself, with a query string ?zem_contact_send_article=yes added ( http://example.com/contact/?zem_contact_send_article=yes )
So if you know how to create a pop-up window, you can manually use such an URL for the popup-window.

Offline

#207 2008-02-14 12:19:18

simsim
Member
Registered: 2006-05-06
Posts: 70

Re: zem_contact_reborn 4.0.3.20

There is no way to customize the “Send article” attributes in any way, which is really lacking behind the customization richness of the plug-in. I had to do <span id="send_article"><txp:zem_contact send_article="1" /> <txp:zem_contact_send_article /></span> but I couldn’t figure out how to make getElementById work on the anchor instead of the span!

Last edited by simsim (2008-02-14 12:20:03)

Offline

#208 2008-02-14 15:48:31

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

My point was that you don’t necessarily have to use the send_article tag. It’s fairly easy to hardcode the URL yourself.

Offline

#209 2008-02-15 02:53:00

maodiddy
Member
From: Seattle, WA - USA
Registered: 2008-02-10
Posts: 17
Website

Re: zem_contact_reborn 4.0.3.20

I would like to edit the zem_contact_reborn plug in to include an additional script that maps the fields of the contact form to the fields in a Delivra database for e-mail newsletters. It does this when a user selects the checkbox named “newsletter” and hits submit. It was working on a simple contact form I had previously (not a textpattern site, but hard-coded html) by including the line
require_once(“delivra.php”);
in the mailto.php form… I would assume I could put that line in the zem_contact_reborn code somewhere, but I don’t know where as I am not that fluent with PHP. Or perhaps I need to change a line in the delivra.php script as well, I don’t know.

I do know that I have the names of all my fields in the form named correctly, so they should map if the newsletter checkbox is checked. I also know that the listname and the post to delivra information is correct (like I mentioned, it was working with another simple contact form before i started working on this textpattern site).

Thank you for any help you can offer in making this work – it’s a cool feature to have as it automatically updates my e-newsletter database with people’s information if they opt in, without me having to create an additional newsletter subscription form.

Thanks!
Michael

See the contact form here: http://maostudios.com/BETA/maoStudios/contact/contactUs

The delivra script (delivra.php) is here:

<?php 
if(isset($_POST["newsletter"]) && $_POST["newsletter"] == 'Y'){
$f = 'list=mao-studios&confirm=none&';
//set post fields

// Set Email
if(isset($_POST['EmailAddr_'])){
$f .= 'email=' . urlencode($_POST['EmailAddr_']);
}else{
$f .= 'email=|';
}

// Set Name
if(isset($_POST["LastName_"])){
$f .= '&name=' . urlencode($_POST["FirstName_"]) . " ". urlencode($_POST["LastName_"]);
}else{
$f .= '&name=|';
}


// Set Last Name
if(isset($_POST["LastName_"])){
$f .= '&LastName_=' . urlencode($_POST["LastName_"]);
}else{
$f .= '&LastName_=|';
}


// Set First Name
if(isset($_POST["FirstName_"])){
$f .= '&FirstName_=' . urlencode($_POST["FirstName_"]);
}else{
$f .= '&FirstName_=|';
}

// Set referral
if(isset($_POST["Text3_"])){
$f .= '&Text3_=' . urlencode($_POST["Text3_"]);
}else{
$f .= '&Text3_=|';
}	

// Set Comments
if(isset($_POST["Comment_"])){
$f .= '&Comment_=' . urlencode($_POST["Comment_"]);
}else{
$f .= '&Comment_=|';
}	 


// Set Demographics
$f .= "&demographics=FirstName_ LastName_ Text3_ Comment_";

// Post to Delivra
$c = curl_init('http://www.ne16.com/subscribe/subscribe.tml');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $f);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);

}
?>

Last edited by ruud (2008-02-15 18:01:31)

Offline

#210 2008-02-15 05:55:54

simsim
Member
Registered: 2006-05-06
Posts: 70

Re: zem_contact_reborn 4.0.3.20

ruud wrote:

My point was that you don’t necessarily have to use the send_article tag. It’s fairly easy to hardcode the URL yourself.

I’ve tried to hardcode the URL since first time but it never worked. You mean like this:

<a href="<txp:permlink />?zem_contact_send_article=yes" onclick="makePopup(args)">Send article</a>?

It never works and the page doesn’t even display on the same page let alone on a popup window. Could it be because I’m using clean URLs mode?

Offline

#211 2008-02-15 08:37:30

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

maodiddy
Member
From: Seattle, WA - USA
Registered: 2008-02-10
Posts: 17
Website

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

maodiddy
Member
From: Seattle, WA - USA
Registered: 2008-02-10
Posts: 17
Website

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

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

maodiddy
Member
From: Seattle, WA - USA
Registered: 2008-02-10
Posts: 17
Website

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

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB