libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Support for email templates and a big set of other changes #44

Closed jpeltoniemi closed 7 years ago

jpeltoniemi commented 7 years ago

This is based on #40 but a lot has changed

Some features need to be documented and this hasn't been completely tested. That said, playing with a few different templates and settings didn't seem to break anything, so this is going to production on my site for now.

Templates work automatically from the plugin's email-templates directory and theme's(+child theme) directory. Themes are searched 1 directory level deep and are identified with the same header format you'd use in page templates. See wp-libre-form/email-templates/default.php.

This is more like a proof of concept and I don't expect it to be pulled as-is. Maybe after I've double-checked everything I hope there's at least some code you can use. Let me know if you find anything that needs to be fixed or changed, and like I said earlier, we can have a chat in finnish to clear things up faster.

anttiviljami commented 7 years ago

<3333 just wow.

jpeltoniemi commented 7 years ago

Phpdoc for functions coming in the next revision. Would've done it already but this took way more time than I though it would and now I'm spending my evening catching up on other work.

anttiviljami commented 7 years ago

I've pushed this branch to https://github.com/anttiviljami/wp-libre-form/tree/feature-email-templates so I can work on it.

I'll still complete a review of your code @jpeltoniemi :) Thanks so much!

jpeltoniemi commented 7 years ago

No problem. I kind of winged the whole thing and changed things on the fly, so I'm sure there's some useless code, confusing names and other stuff I wouldn't consider ok for master branch. I'll try to clean things up a bit as soon as I can - probably before next weekend. Would it be okay if you review this version and tell me what needs to be changed and if you find any bugs?

anttiviljami commented 7 years ago

Great work! :+1: Sorry it took me so long to actually get to reviewing this changeset.

The logic here seems solid. I'm just not sure if providing non-user editable code templates is exactly what we need here. We already have that functionality without needing to conform to a set templating style or language.

The main need as I've seen it is that the end-customer wants to be able to edit the email that gets sent out in the WordPress admin view.

I think we need a new custom post type for email templates that you can then link to the forms. It would also be necessary to choose email field(s) in the form to be used as the recipient for those email templates.

I'm going to close this PR just because the codebases have diverged quite a bit and it would be really hard to keep track of this in the long run.

Please feel free to fork this project as your own Libre Form, or rebase to our current master branch and do a new PR.

👍

jpeltoniemi commented 7 years ago

Just dropping in to say sorry that I couldn't find the time to work on this more (Can't even remember what my PR was about or what I intended to do later :D ). Glad if at least some of my code were of use in some way or another :)