vader7071
Forum Replies Created
-
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionJohn, have you had a chance to look at my updated information?
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionAn update. In my CF7 Form tab, I have these 2 lines:
[simplehidden wpcf7-dynamic-mail-to-filter "subject"] [simplehidden wpcf7-dynamic-mail-to-filter "mail-to"]
In my CF7 Mail tab, I have these 2 lines:
[mail-to] [wpcf7-dynamic-mail-to-filter]
In the plugin folder (contact-form-7-dynamic-mail-to) I have a file named
cf7-dynamic-mail-to.php
that has the following code. This same code is also in my
function.php
file for the theme.
new wpcf7_dynamic_email_to(); class wpcf7_dynamic_email_to { // these are the email addresses to be used to for setting the recipient email address in cf7 private $email_address_1 = '[email protected]'; private $email_address_2 = '[email protected]'; private $email_address_3 = '[email protected]'; private $email_address_4 = '[email protected]'; private $email_address_5 = '[email protected]'; public function __construct() { add_filter('wpcf7-dynamic-email-to', array($this, 'filter'), 10, 2); } // end public function __construct public function filter($recipient, $args=array()) { //echo '(',$recipient,')'; //print_r($args); die; if (isset($args['subject'])) { if ($args['subject'] == 'Becoming an athletic competitor') { $recipient = $this->email_address_1; } elseif ($args['subject'] == 'Sponsoring the Highland Games') { $recipient = $this->email_address_2; } elseif ($args['subject'] == 'Wanting to be a Vendor') { $recipient = $this->email_address_3; } elseif ($args['subject'] == 'Clan Information') { $recipient = $this->email_address_4; } elseif ($args['subject'] == 'Something not listed here') { $recipient = $this->email_address_5; } } return $recipient; } // end public function filter } // end class wpcf7_dynamic_mail_to
Here are my results.
When I send the email, this is what I get:
[mail-to]
mail-toSo the
[mail-to]
tag is not getting filled and the form is just dumping the place holder as is. But the tag[wpcf7-dynamic-mail-to-filter]
is getting filled with “mail-to”.So, here is where I am. I have made a little progress, but I am still at a loss. I cannot seem to find why the tags are not being filled properly.
- This reply was modified 6 years, 10 months ago by vader7071.
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionTrying to get this figured out, let me share what all I have right now.
1) I have the “Dynamic Recipient for Contact Form 7” plugin added. I also have the “Hidden Field” as well.
In /[root]/wp-content/plugins/contact-form-7-dynamic-mail-to I have these files:
cf7-dynamic-mail-to.php
cf7-dynamic-mail-to-examples.php
README.md
readme.txtI have gone into examples and copied the code into notepad and modified it to what I need. I then used the example code and replace the code in just “cf7-dynamic-mail-to.php”. This is what I have:
<?php /* Plugin Name: Dynamic Recipient for Contact Form 7 Plugin URI: https://github.com/Hube2/contact-form-7-dynamic-mail-to Description: Alter the to email address of mail in Contact Form 7 dynamically. Requires Contact Form 7 Version: 1.0.0 Author: John A. Huebner II Author URI: https://github.com/Hube2/ License: GPL */ // If this file is called directly, abort. if (!defined('WPINC')) { die; } //include(dirname(__FILE__).'/cf7-dynamic-mail-to-examples.php'); new wpcf7_dynamic_mail_to(); class wpcf7_dynamic_mail_to { // these are the email addresses to be used to for setting the recipient email address in cf7 private $email_address_1 = '[email protected]'; private $email_address_2 = '[email protected]'; private $email_address_3 = '[email protected]'; private $email_address_4 = '[email protected]'; private $email_address_5 = '[email protected]'; public function __construct() { add_filter('wpcf7-dynamic-mail-to-filter', array($this, 'filter'), 10, 2); } // end public function __construct public function filter($recipient, $args=array()) { //echo '(',$recipient,')'; //print_r($args); die; if (isset($args['subject'])) { if ($args['subject'] == 'Becoming an athletic competitor') { $recipient = $this->email_address_1; } elseif ($args['subject'] == 'Sponsoring the Highland Games') { $recipient = $this->email_address_2; } elseif ($args['subject'] == 'Wanting to be a Vendor') { $recipient = $this->email_address_3; } elseif ($args['subject'] == 'Clan Information') { $recipient = $this->email_address_4; } elseif ($args['subject'] == 'Something not listed here') { $recipient = $this->email_address_5; } } return $recipient; } // end public function filter } // end class wpcf7_dynamic_mail_to ?>
In my Contact Form 7 form, I have this code:
<label> [text* your-name placeholder 'Your Name *' ] </label> <label> [email* your-email placeholder 'Your Email *'] </label> <label> [select* subject "Becoming an athletic competitor" "Sponsoring the Highland Games" "Wanting to be a Vendor" "Clan Information" "Something not listed here"]</label> <label> [textarea* your-message placeholder 'Your Message *'] </label> [simplehidden wpcf7-dynamic-mail-to-filter "mail-to"] [simplehidden wpcf7-dynamic-mail-to-filter "subject"] [submit "Send"]
Then in my “Mail” settings, in the body of the email, I have a tag [mail-to] just to make sure it is changing.
Everything looks like it should work, but it isn’t. The PHP file that the code is in is called “cf7-dynamic-mail-to.php” while the filter being called is “wpcf7-dynamic-mail-to”. Could that be the issue? I am at a total loss of what I have wrong or what I have missing.
- This reply was modified 6 years, 10 months ago by vader7071.
Forum: Themes and Templates
In reply to: [Krystal] Help with sizing drop down boxThat did it!!! Perfect! Thank you.
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionRight now I have Dynamic Recipient for Contact Form 7 and Hidden Field for Contact Form 7 loaded. I am loading Dynamic Select now.
Am I headed in the right direction?
Am I correct putting the code in my function.php file?
- This reply was modified 6 years, 10 months ago by vader7071.
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionHi John. Yeah, I pretty much had myself totally confused in the beginning. Let’s see if I can start over and make it simple.
I found your plugin (Dynamic Recipient for Contact Form 7). I believe this will do what I want to do. I found it after I started this thread. So if I need to move this, I don’t mind.
That being said. I have a drop down list for my tag called [subject]. The user can choose one of 5 choices.
What I am trying to accomplish, is to change the value of a tag [mail-to] (this can be called anything) based on what is in [subject].
Looking at Dynamic Recipient for Contact Form 7, it looks like that filter does just that. However, I am not getting the output. When the email sends, the tag [mail-to] remains exactly that, “[mail-to]”. It does not update.
For testing purposes, I have the email going to a static email address and just a tag in the body that changes so I can see what is going on.
In my second post, the upper block of code is what I have put into my function.php file. I constructed that from looking at the plugin examples.
Forum: Plugins
In reply to: [Hidden Field for Contact Form 7] Setting up filter questionOk, tried to go back and edit. Just about everything I have above is incorrect.
Here is what I have now, after a little more digging and understanding.
In my “Contact Form 7” code:
<label> [text* your-name placeholder 'Your Name *' ] </label> <label> [email* your-email placeholder 'Your Email *'] </label> <label> [select* subject "Becoming an athletic competitor" "Sponsoring the Highland Games" "Wanting to be a Vendor" "Clan Information" "Something not listed here"]</label> <label> [textarea* your-message placeholder 'Your Message *'] </label> [simplehidden dynamic-mail-to-filter "mail-to"] [simplehidden dynamic-mail-to-fields "subject"] [submit "Send"]
FYI, [mail-to] is the tag I am trying to have change.
I have added this snipped of code into my function.php file for the theme:
/** * Dynamic Mail-To fields for Contact Form */ /* Select Mail */ function __construct() { add_filter('wpcf7-dynamic-mail-to-example-filter', array($this, 'filter'), 10, 2); } // end public function __construct function filter($recipient, $args=array()) { if (isset($args['subject'])) { if ($args['subject'] == 'Becoming an athletic competitor') { $recipient = '[email protected]'; } elseif ($args['subject'] == 'Sponsoring the Highland Games') { $recipient = '[email protected]'; } elseif ($args['subject'] == 'Wanting to be a Vendor') { $recipient = '[email protected]'; } elseif ($args['subject'] == 'Clan Information') { $recipient = '[email protected]'; } elseif ($args['subject'] == 'Something not listed here') { $recipient = '[email protected]'; } } return $recipient; }
When I run the form from my website, this is the body that is transmitted:
From: [your-name] <[your-email]> Subject: [subject] [mail-to] Message Body: [your-message] -- This e-mail was sent from a contact form on domain.com
The [mail-to] is just to see if it is changing. When I test, the [mail-to] does not change. It remains exactly [mail-to]. It doesn’t even populate from the filter.
Forum: Plugins
In reply to: [Conditional Fields for Contact Form 7] Choose recipient based on drop downUpdate, Your plugin actually plays a role to accomplish this.
Doing some reading, what I have to do is use Contact Form 7 to create the form layout.
Then I use Conditional Fields for Contact Form 7 to set groups based on which subject is selected.
Once I have the group activated based on the subject, then inside the group, I set my [mail-to] tag to change the email address I am sending to.
But here is where I am struggling some. I think I need to use the Hidden Field for Contact Form 7 plugin as well. But I am still working on the group staging to make sure I am correct.
One step at the time.
Forum: Plugins
In reply to: [Contact Form 7] Choose recipient based on drop downThat is close, thank you. But how do I modify a second mail-tag?
In logic code, I need:
If [subject] = Selection_A
[mailto] = email_1; email_2else If [subject] = Selection_B
[mailto] = email_3; email_4else If [subject] = Selection_C
[mailto] = email_5else If [subject] = Selection_D
[mailto] = email_5; email_6; email_7But that was helpful to know I can hide information in the background. Thank you.
Forum: Plugins
In reply to: [Conditional Fields for Contact Form 7] Choose recipient based on drop downOh, I apologize. I wasn’t sure if this would be handled via your add-on or the original plugin. But thank you for helping!
I will try your suggestion. THANKS!
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Custom Pagination for a tableOh, even better. I’ll make that change. Thank you!
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Custom Pagination for a tableThat was perfect. My main page (with all entries) paginates to 10 (I used
datatables_paginate_entries=10
) and all of my decades paginate to 11 (I useddatatables_paginate_entries=11
). Exactly what I want. Thank you.Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Custom Pagination for a tableOh perfect. Thanks. So under table settings, ignore the paginate portion there, and just use this shortcode in its place.
Forum: Fixing WordPress
In reply to: searchable sortable tableThat is EXACTLY what I was looking for! Well worth the $20! Thank you.
@aga2442, the plugin updates fixed the issue for me on all my sites.