Before you ask please READ THIS

Contact Form Subject

edited February 2013 in Skyfashion Posts: 10
One of the problems I was experiencing with my last site was the Contact Form - it uses a static subject approach.. which is fine - but the problem is if you use gmail, then it will group emails of the same subject which isn't ideal, especially if you expect a lot of traffic that way.

On Skyfashion there's a Subject field, but it doesn't seem to be utilized at all. When I sent my test message, I received:

--
SUBJECT: .am - message from contact form
--
Site: .am

Name: Alex

Email: test@test.tld

Subject: .am - message from contact form

Message: Test body.
--

So whatever text I entered into the subject field was completely ignored, and then static text was pulled from the e-mail subject and repeated, again, in the body.

I've located the code in apollo13.php

--
if (empty($name))
$name_error = true;
if (empty($email) || !is_email($email))
$email_error = true;
if (empty($subject))
$subject_error = true;
if (empty($content))
$content_error = true;
if ($name_error == false && $email_error == false && $content_error == false && $subject_error == false) {
$subject = $site . __(' - message from contact form', TPL_SLUG);
$body = __('Site: ', TPL_SLUG) . $site . "\n\n"
. __('Name: ', TPL_SLUG) . $name . "\n\n"
. __('Email: ', TPL_SLUG) . $email . "\n\n"
. __('Subject: ', TPL_SLUG) . $subject . "\n\n"
. __('Message: ', TPL_SLUG) . $content;
$headers = "From: $name <$email>\r\n";
$headers .= "Reply-To: $email\r\n";
if (wp_mail($email_to, $subject, $body, $headers)) {
$title_msg = __('Success sending form', TPL_SLUG);
} else
$title_msg = __('Something wrong. Try again!', TPL_SLUG);
} else {
$title_msg = __('Error in form', TPL_SLUG);
if (!empty($name))
$name_tag = 'value="' . $name . '"';
if (!empty($email))
$email_tag = 'value="' . $email . '"';
if (!empty($subject))
$phone_tag = 'value="' . $subject . '" title="' . __('General question ...', TPL_SLUG) . '"';
if (!empty($content))
$content_tag = $content;
}
--

And what I want is, essentially

--
SUBJECT: $site | $subject-user-entered
--
Name:
Email:

Message:
--

How would I go about amending the code to do that? Because this:

$subject = $site . __(' - message from contact form', TPL_SLUG);
. __('Subject: ', TPL_SLUG) . $subject . "\n\n"

Seems a little pointless.

Comments

  • AirAir
    Posts: 10,970
    I am not here to answer :-)
    Just to clarify: It was mistake copied in many our themes unfortunately not intended action.

    With regards.
  • If the issue is a known one, would it not make sense to either post a fix or amend it?
  • Hi,
    sorry for late response. I am responsible for Skyfahion.
    Thank you for your information.
    It seems you need to only delete this line:

    $subject = $site . __(' - message from contact form', TPL_SLUG);
    And all should be alright.
    I will add it in the next update.

    Best,
    Miłosz
Sign In or Register to comment.