| Post |
|
Guest
| David Hutchison 6:00 am July 23, 2008
| |
|
|
Please replace the ??? with your data!
- Your URL: none – local install for testing
- The browser used: safari
- cforms version:8.5.2
- Your Wordpress version: 2.6
I have many posts which each describe an organization, with contact information etc.
I would like to use a cform as a contact form so that a user can send an email to that organization, without publicly revealing the contact email address.
Can I use data from the post – the title which is the name of the organization – and perhaps a custom wordpress field in the post to hold the email address – to prepopulate a contact form.
Also, assuming I can prepopulate, I can only see the tell-a-friend as a way but it will not keep the email address hidden – I cannot see how to hide this field.
Any help wold be really appreciated! _
|
|
|
Admin
| Oliver Munich, Germany posts 6096 7:48 am July 23, 2008
| |
|
|
Yes you can. See this thread (it's the same requirement).
|
|
|
|
|
Guest
| David Hutchison 9:41 am July 24, 2008
| |
|
|
Thank you! I have spent a good deal of time trying this but still have one error I can't handle.
Firstly, in the example yo suggest creating a custom field called "email_address" and then proceed to use dir_listing_email in the example code. Assuming I'm right, no big deal.
That said I think there is some issue with these lines:
$dle = get_post_custom_values( 'dir_listing_email', $pid );
$dle = implode($dle,', ');
$m = str_replace( '{dir_listing_email}', $dle, $m );
I say that because if I comment out the first two lines and add one saying:
$dle = 'bill@microsoft.com'; // well of course my email address actually
then it works just fine.
I've tried the 'get_post_meta' option for retrieving and that's no good either.
Yes, I spelled the custom key name fine…
Can you see anything? Is there a way to echo the contents of dle to see what is pulled from the custom key? I trust a simple echo won't do the trick…
|
|
|
Admin
| Oliver Munich, Germany posts 6096 10:25 pm July 24, 2008
| |
|
|
Yep, the first "suggestion" (email_address) was merely an example.
I've tried the 'get_post_meta' option for retrieving and that's no good either.
Odd. This was off top of my head, but still, I can't see anything wrong with it, not from a principal point of view anyway. Check "$pid", if it indeed contains the proper post ID otherwise get_post_custom_values won't work.
Can you see anything? Is there a way to echo the contents of dle to see what is pulled from the custom key? I trust a simple echo won't do the trick…
sure, just add echo "pid = ".$pid; and make sure you try submitting your form with Ajax disabled (otherwise you won't see the echo).
|
|
|
|
|
Guest
| David Hutchison 11:17 pm July 24, 2008
| |
|
|
Thanks for this – I had tried echo but not disabling AJAX.
Now I'm thoroughly confused. echo shows that the correct email address is being pulled from the post.
I hit submit on the form and get taken to a blanked out version of the post page which I imagine is a non-ajax place that a message might be displayed? Anyway, no complaints and it seems to work – but no email comes through. I'm assuming this could well be that I now have my machine connected wirelessly on another network and my mail server settings could well be wrong – I'll need to test this part at home tonight. However…
When I go back to AJAX mode – and I trust the email address is pulled still fine since the code I was using echo in is in lib_aux.php but I get my message again about needing to supply one recipient email address…
The only difference I see in lib_aux is in the first if / else-if construct that assigns pid where the lines:
else if($ Ajaxpid <> '')
$pid = $Ajaxpid;
have me wondering if the pid can be assigned differently in Ajax mode?
Thanks for all your help – it really is appreciated and while frustrated – I'm learning lots which makes it worth the effort!
|
|
|
Admin
| Oliver Munich, Germany posts 6096 11:41 pm July 24, 2008
| |
|
|
Right, for the Ajax version to pull the right email address, you need to enable (on your cforms form config page), I missed to mention that:
Extra variables e.g. {Title}
in Core Form Admin / Email Options.
Generally, testing in nonAjax mode is more practical due to being able to use 'echoes'. You could for instance have a test echo in lib_nonajax.php, just before
@mail($to…
to print $to, which should be the email address from the custom field.
|
|
|
|
|
Guest
| David Hutchison 12:09 am July 25, 2008
| |
|
|
Thank you!
No net connection now but this time it's an SMTP error so it sounds like success.
|
|
|
Guest
| ArleyM 9:48 pm September 2, 2011
| |
|
|
Oliver said:
Yes you can. See this thread (it's the same requirement).
Nooooooooooooooooooooooooooooooooooo…. dead link. Would really like to know!
I'm trying to pass a product name to the form to populate a select dropdown box. I bet that was the title of the post.
Forever alone.
|
|
|
Guest
| ArleyM 5:00 pm September 30, 2011
| |
|
|
|
|
Guest
| ArleyM 5:10 pm September 30, 2011
| |
|
|
I found where the link is supposed to go! I read through it and it's completely way over my head. These instructions would be good enough if I was trying to tweak the email as in your example, but I'm trying to use a URL string to populate a Products Select input.
If I knew the lines of code to update that would be exceedingly helpful. Otherwise this code is a bit scary – I feel like the ramifications of changing this code could be huge. Any help would be amazingly helpful.
Thanks!
|
|
|
Guest
| robi 5:10 am October 7, 2011
| |
|
|
Oliver said:
Yes you can. See this thread (it's the same requirement).
dead link. can someone give me the tutorial ?
|
|