danielshafer
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Dynamic Recipient for Contact Form 7] Configuration problemThanks!
Forum: Plugins
In reply to: [Dynamic Recipient for Contact Form 7] Configuration problemI’ve added the following (but with real email addresses) to the functions.php but still no luck. Hopefully it’s something simple that I’m missing. Thanks!
class wpcf7_dynamic_mail_to_examples { // 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]'; public function __construct() { add_filter('wpcf7-dynamic-mail-to-example-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['select-email'])) { if ($args['select-email'] == 'send to email 1') { $recipient = $this->email_address_1; } elseif ($args['select-email'] == 'send to email 2') { $recipient = $this->email_address_2; } elseif ($args['select-email'] == 'sent to email 3') { $recipient = $this->email_address_3; } } return $recipient; } // end public function filter } // end class wpcf7_dynamic_mail_to_examples new wpcf7_dynamic_mail_to_examples(); function wpcf7_dynamic_to_filter_example() { if (isset($args['select-email'])) { if ($args['select-email'] == 'send to email 1') { $recipient = '[email protected]'; } elseif ($args['select-email'] == 'send to email 2') { $recipient = '[email protected]'; } elseif ($args['select-email'] == 'send to email 3') { $recipient = '[email protected]'; } } return $recipient; } // end function wpcf7_dynamic_to_filter_example add_filter('wpcf7-dynamic-recipient-example-filter', 'wpcf7_dynamic_to_filter_example', 10, 2);
Viewing 2 replies - 1 through 2 (of 2 total)