Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding confirmation subject not working #177

Open
arentsen opened this issue Jul 8, 2023 · 3 comments
Open

Overriding confirmation subject not working #177

arentsen opened this issue Jul 8, 2023 · 3 comments
Assignees

Comments

@arentsen
Copy link

arentsen commented Jul 8, 2023

The "Overriding the confirmation subject" does not work, it just keeps using the Subject that was set in the general plugin settings (/settings/plugins/contact-form-extensions). I need to override it since the website is in two languages and they both need a different Subject.

I added a hidden field for that:

It would be great to be able to use Twig for the confirmation subject, because then we could just give it a translate filter.

@rosskenney rosskenney self-assigned this Nov 9, 2023
@jornwildenbeest
Copy link

@arentsen By looking at the code it looks like the docs is wrong:

// Check for subject override $confirmationSubject = null; if (is_array($e->submission->message) && array_key_exists('confirmationSubject', $e->submission->message)) { $confirmationSubject = Craft::$app->security->validateData($e->submission->message['confirmationSubject']); } else { $confirmationSubject = $this->settings->getConfirmationSubject(); } $message->setSubject($confirmationSubject);

So the html should be

<input type="hidden" name="message[confirmationSubject]" value="{{ 'subject'|hash }}">

instead of

<input type="hidden" name="message[subject]" value="{{ 'subject'|hash }}">

@rosskenney
Copy link
Contributor

@jornwildenbeest I will take a look at this but there is a subject and a confirmation subject. One for the email that goes to notify the site owner and one that goes to the person who filled out the form (confirmation.) Both can have an override and the subject override actually comes from the P&T plugin. The confirmation subject comes from this plugin. I am in the process of cleaning all of this up though and separating things out from the message array which will allow for better twig filtering etc.

@jornwildenbeest
Copy link

@rosskenney Yes implemented this to another form of ours today!

message[confirmationSubject] goes to the person who filled out the form indeed! And subject to the site owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants