我有大約6個子域名有「聯繫我們」鏈接,我將所有這些鏈接發送到使用「聯繫表單」 7" 。我將?from = site-name添加到每個鏈接,以便我可以在聯繫人表單中設置$ referencedFrom變量。黑客「聯繫表單7」代碼添加「推薦人」字段
我唯一缺少的兩件事是:(1)能夠將這個referencedFrom變量插入到我有人提交表單時得到的電子郵件中;(2)將用戶重定向到他們來的網站的能力from(存於$ referFrom)
有沒有想法?
下面是一些代碼從包括,我認爲可能是電子郵件插件的一部分,但它沒有做多少/ classes.php ...
function mail() {
global $referrer;
$refferedfrom = $referrer; //HERE IS MY CUSTOM CODE
$fes = $this->form_scan_shortcode();
foreach ($fes as $fe) {
$name = $fe['name'];
$pipes = $fe['pipes'];
if (empty($name))
continue;
$value = $_POST[$name];
if (WPCF7_USE_PIPE && is_a($pipes, 'WPCF7_Pipes') && ! $pipes->zero()) {
if (is_array($value)) {
$new_value = array();
foreach ($value as $v) {
$new_value[] = $pipes->do_pipe($v);
}
$value = $new_value;
} else {
$value = $pipes->do_pipe($value);
}
}
$this->posted_data[$name] = $value;
$this->posted_data[$refferedfrom] = $referrer; //HERE IS MY CUSTOM CODE
}
我還以爲我能插referredFrom代碼某處此功能,以及...
function compose_and_send_mail($mail_template) {
$regex = '/\[\s*([a-zA-Z][0-9a-zA-Z:._-]*)\s*\]/';
$callback = array(&$this, 'mail_callback');
$mail_subject = preg_replace_callback($regex, $callback, $mail_template['subject']);
$mail_sender = preg_replace_callback($regex, $callback, $mail_template['sender']);
$mail_body = preg_replace_callback($regex, $callback, $mail_template['body']);
$mail_recipient = preg_replace_callback($regex, $callback, $mail_template['recipient']);
$mail_headers = "From: $mail_sender\n";
if ($mail_template['use_html'])
$mail_headers .= "Content-Type: text/html\n";
$mail_additional_headers = preg_replace_callback($regex, $callback,
$mail_template['additional_headers']);
$mail_headers .= trim($mail_additional_headers) . "\n";
if ($this->uploaded_files) {
$for_this_mail = array();
foreach ($this->uploaded_files as $name => $path) {
if (false === strpos($mail_template['attachments'], "[${name}]"))
continue;
$for_this_mail[] = $path;
}
return @wp_mail($mail_recipient, $mail_subject, $mail_body, $mail_headers,
$for_this_mail);
} else {
return @wp_mail($mail_recipient, $mail_subject, $mail_body, $mail_headers);
}
}
http://wordpress.org/extend/plugins/contact-form-7/ – 2010-04-05 11:31:02