0

I am creating a bilingual site. I have a form with various fields and one of them is a datepicker (using the template's tools - the datepicker passes thedata in a text field). When the user chooses "English" for a strange reason the date changes format and from dd-mm-yy becomes mm-dd-yy. I was not able to find a solution with the template's tools so I thought that before the form is sent to the owner of the site there would be a mechanism that checks if the language is english and if yes then it parses the field, makes the adjustement and then sends the form. So far I was able to access this data but I am not able to modify it.

I have created a hook (before_send_mail) and in there

$submission = WPCF7_Submission::get_instance(); $data = $submission->get_posted_data();

$data['date'] gives me the access to the field, I can modify it, even save a file with the value but the email that arrives contains the values unaltered. What can I do to alter the value of the field before it is sent?

Please do not tell me to change the field from text to date or to contact the template's creator. The first one is not possible the second is ongoing.

closed as off-topic by Milo, Howdy_McGee, Mark Kaplun, kaiser May 27 '16 at 20:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • If it is ongoing, then please stick with that route and see how it turns out. Not posting anything from this conversation and probably vice versa is equal to a slap in ones face: You are doubling the efforts on both ends. Please, do not do that. Anywhere. At any time. – kaiser May 27 '16 at 20:41
  • Well.....hmmmmm.....searching alternative routes is a slap on the face of someone? The route chosen with contacting the author has other types of solutions. I have chosen the one I mentioned in this site because it will provide me a better way in handling Wordpress and the way it comunicates with the various plugins - regardless of the template - knowledge I could use in the future and help others. I thought that this was the point of this site. I guess not. Sorry to bother you. – user1496047 May 28 '16 at 7:14
  • By "route", I meant "support route". If you are in contact with the author, stick with that. Again: You are doubling the efforts on his as well as on our end. No one appreciates that, so yes, that bothers people. – kaiser May 28 '16 at 11:04
1

This could be outdated but I suggest turning on your debug_log and print the following code in the before_send_mail hook:

error_log( print_r( $submission, 1 ) );

That will give you an idea of what you're dealing with. The below may be outdated but I think what you need to modify is the $submission->mail array.

Not the answer you're looking for? Browse other questions tagged or ask your own question.