Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added domain field in settings so full email isn't required in form f…

…ield value
  • Loading branch information...
commit 35d761292220ec0e3b0f86e8addb4a3bdf217da1 1 parent 1b53846
@erikreagan erikreagan authored
View
1  README.textile
@@ -14,6 +14,7 @@ h2. Changelog
* Updated by Erik Reagan, erikreagan.com
* Added settings to control panel for both form field names and additional email addresses
+* Added domain setting so input values don't have to store entire email addresses
* Added language file for settings
Version 1.0.4 – (Jul 17, 2008)
View
46 extensions/ext.md_freeform_send_another.php
@@ -49,6 +49,7 @@ function settings()
global $LANG;
$settings = array();
$settings['form_fields'] = 'recipient';
+ $settings['domain'] = '';
$settings['additional_emails'] = '';
return $settings;
}
@@ -68,14 +69,14 @@ function activate_extension()
{
$sql[] = $DB->insert_string( 'exp_extensions',
array(
- 'extension_id' => '',
- 'class' => get_class($this),
- 'method' => $method,
- 'hook' => $hook,
- 'settings' => "",
- 'priority' => 10,
- 'version' => $this->version,
- 'enabled' => "y"
+ 'extension_id' => '',
+ 'class' => get_class($this),
+ 'method' => $method,
+ 'hook' => $hook,
+ 'settings' => "",
+ 'priority' => 10,
+ 'version' => $this->version,
+ 'enabled' => "y"
)
);
}
@@ -135,10 +136,13 @@ function freeform_module_insert_end ($fields, $entry_id, $msg)
// Grab the recipients from the form results
$form_fields = $this->settings['form_fields'] ? preg_split("/,|\|/" , $this->settings['form_fields'] ) : '';
- if (is_array($form_fields)) {
- foreach ($form_fields as $field) {
+ if (is_array($form_fields))
+ {
+ foreach ($form_fields as $field)
+ {
// Make sure there's actually a freeform field with this name and that the field value is not empty
- if ((array_key_exists($field, $query->row) && ($query->row[$field] != ''))) {
+ if ((array_key_exists($field, $query->row) && ($query->row[$field] != '')))
+ {
$all_recipients[] = $query->row[$field];
}
}
@@ -148,13 +152,16 @@ function freeform_module_insert_end ($fields, $entry_id, $msg)
// Grab the additional email addresses from the CP settings
$email_recipients = $this->settings['additional_emails'] ? preg_split("/,|\|/" , $this->settings['additional_emails'] ) : '';
- if (is_array($email_recipients)) {
- foreach ($email_recipients as $address) {
+ if (is_array($email_recipients))
+ {
+ foreach ($email_recipients as $address)
+ {
$all_recipients[] = $address;
}
}
+
// echo '<pre>';
// print_r($all_recipients);
// print_r($msg);
@@ -167,11 +174,14 @@ function freeform_module_insert_end ($fields, $entry_id, $msg)
require PATH_CORE.'core.email'.EXT;
}
- $email = new EEmail;
- $email->wordwrap = FALSE;
- $email->mailtype = 'html';
+ $email = new EEmail;
+ $email->wordwrap = FALSE;
+ $email->mailtype = 'html';
- foreach ($all_recipients as $recipient) {
+ foreach ($all_recipients as $recipient)
+ {
+
+ if ( strpos($recipient,'@') === FALSE ) $recipient .= $this->settings['domain'];
$email->initialize();
$email->from($msg['from_email'], $msg['from_name']);
@@ -190,4 +200,4 @@ function freeform_module_insert_end ($fields, $entry_id, $msg)
/* END class */
}
/* End of file ext.md_freeform_send_another.php */
-/* Location: ./system/extensions/ext.md_freeform_send_another.php */
+/* Location: ./system/extensions/ext.md_freeform_send_another.php */
View
1  language/english/lang.md_freeform_send_another.php
@@ -13,6 +13,7 @@
"form_fields" => "Freeform Form fields <small style='display:block; margin-top:6px; font-weight:normal'>A pipe delimited list of possible form field names which will contain additional email address for notification.</small>",
+"domain" => "If you leave out the domain in the input values you can enter it here and it will be appended (eg: @erikreagan.com)",
"additional_emails" => "Additional Email Addresses <small style='display:block; margin-top:6px; font-weight:normal'>A pipe delimited list of additional email address to include in notification.</small>",
Please sign in to comment.
Something went wrong with that request. Please try again.