ver-1.0.10
This plugin "knits" together other plugins. Rather than trying to "do it all" this plugin leverages from other great plugins.
When a Contact Form 7 form is submitted, this plugin saves the uploaded image files to the Media Library. Then this plugin can create a "pending post" from a template post page. The first uploaded image is attached as the post's featured image
Some of these are not stable versions.
To use this plugin, you need to add some things to your contact-forms-7 forms. See the "Contact Form Settings" and the "Flamingo" sections.
Also, you need to create a template for your posts. See the "Template Page" section.
Uploaded images are saved for forms that have a "file" type. See "Uploaded Files" section.
If you installed ninja-auto-post-expire, the "Post" option needs to be set to "Yes" for the Post Expire Setting to be active. See: Settings -> Post Expire Settings -> Post.
In the contact form's "Additional Settings" tab, add these settings:
create_post: true
post_template: PageSlug
skip_mail: on
do_not_store: false
create_post - this turtle-template-form-knitter plugin
option. If 'true' that activates this plugin
post_template - this turtle-template-form-knitter
plugin option. This is the "slug-name" for a "page" that will be used
as a template to generate a "Pending" post from a form. See "Template
Page" for details.
skip_mail - contact-form-7 plugin option. This has no
effect on the turtle-template-form-knitter plugin, but you can decide
if you want to send an email of the form, in addition to making a
post.
do_not_store - flamingo plugin option. The default is
'false'. If it is set to 'true', the form data will not be stored and
this turtle-template-form-knitter plugin will not work.
This plugin does not "publish" the posts, but you should turn on reCAPTCHA in contact-form-7 settings so your admin doesn't get spammed with bot submitted "Pending" posts.
When do_not_store is set to true, form data will not be
saved in the DB.
For the turtle-template-form-knitter plugin to work, this option needs to be set to "false", or not put in a form's "Additional Settings" tab.
You can decide if a form's data will be saved in the DB, independent of this plugin. However, you'll want to cleanup old form data. Visit Flamingo -> Inbound Messages to select the messages to be trashed. You can also trash email addresses that are no longer needed.
Flamingo documentation can be found at: https://contactform7.com/save-submitted-messages-with-flamingo/
For each contact form, you will create a page that includes the contact-form-7 block the selects the form. See https://turtleengr.github.io/WP-turtle-template-form-knitter/example.html#contact-form-page
When you install a newer version of turtle-template-form-knitter, you will need to flush the browser and WordPress caches, so any JavaScript changes will be used. Or you can set your WordPress cache to not cache the form pages.
All the blocks of the 'PageSlug' page are copied to the new
post. {field} is replaced with the value of the form 'field'
with that name. The field's HTML text is escaped. Also, "[" "]" is encoded
so they cannot run a shortcode. Checkbox values are joined with ",". If
there is no fields with that name, {field} is left as is.
Textarea fields are the exception: they can have some HTML. When HTML text is pasted into a form's textarea, it is cleaned, and the textarea shows the HTML tags that are kept. Only these tags are kept: h1, h2, h3, h4, a, p, b, strong, i, em, ul, ol, li, br. All attributes are removed, except href on "a" tags, and only for http, https, or mailto URLs. Other tags are removed (their text is kept), and script and style elements are removed with their content. The same cleaning is done again when the post is created. If a textarea value has none of the allowed tags, it is escaped like other fields.
So that the post can be edited in the block editor, a {field} with p, h1-h4, ul, or ol tags is changed to blocks: Paragraph, Heading, and List blocks. This only works when the {field} is in a Paragraph block in the template. Any text before or after the {field} in that paragraph is put in its own paragraph. In other blocks (for example a Heading), only the inline tags are kept, and the block tags are changed to line breaks.
A post's attributes are not blocks, so they are defined in the template between ATTR-BEGIN and ATTR-END lines, which are put after the Title. ATTR-BEGIN to ATTR-END and the text between them are not copied to the post; they are used to set the post's attributes. FYI, all of them are optional.
ATTR-BEGIN
title: {your-subject}
categories: {field}
tags: {field}
publish-date: {field}
expire-date: {field}
expire-time: {field}
ATTR-END
title - post title. See Flamingo documentation for how
to change {your-subject} Default: UNDEFINEDcategories, tags - comma separated names or
slugs. Only existing categories and tags are used; others are ignored.
Default: emptypublish-date - YYYY-MM-DD, time is set to 12:00. This
date is kept when the post is published (a future date makes it
"Scheduled"). Default: the time the post is published.expire-date - YYYY-MM-DD. Saved in the
ninja-auto-post-expire meta (_njtape_expiration_date).
Default: not set.expire-time - HH:MM. Default: 00:00ninja-auto-post-expire only acts on posts if its "Post" option is set to "Yes" in it's settings, Post Expire Settings.
Invalid dates or times are ignored. An invalid expire-date is also shown in the error popup. See "Error Popup".
For an example Template Page see: https://turtleengr.github.io/WP-turtle-template-form-knitter/example.html#template-page
Files uploaded with the Contact Form 7 [file NAME] field
are saved to the Media Library.
If a post is created, the first saved image is the post's Featured Image.
When a form is successfully filled out, and the "Additional Settings" are set to create a post, a "Pending" post will be created. You can now edit the post to clean it up. Mainly you'll want to delete the Notes section. If you find you are continually moving things around, you might want to change the template page for the generated posts.
Complete examples can be found at https://turtleengr.github.io/WP-turtle-template-form-knitter/example.html
If you need help, the Forum https://wordpress.org/support/plugin/turtle-template-form-knitter/ is the best place to start.
Plugin bugs and documentation bugs can be filed at: https://github.com/TurtleEngr/WP-turtle-template-form-knitter/issues You can also make Feature Requests there.
However, DO NOT REPORT SECURITY RELATED BUGS IN THE ISSUES AREA OR IN A PUBLIC FORUM–that gives the crackers access before the problem can be repaired. Follow the wordpress.org guidelines at https://developer.wordpress.org/plugins/wordpress-org/reporting-plugin-security-issues/ They will disable the plugin and let the plugin authors know, so they can fix the defect.
If you want to modify this plugin's code, you can find the directions at: https://turtleengr.github.io/WP-turtle-template-form-knitter/development.html
When a Contact Form 7 form is submitted any errors in turtle-template-form-knitter will be reported in a popup. For example:
Turtle Template Form Knitter errors. Post not created.
To report, copy these errors now (they are not saved).
file type not allowed, not saved: photo.exe
invalid expire-date: "2026-13-01"
If you see an error pop-up, the submit has failed, even if a "success" message is displayed. If you can't correct the problem, or it looks like an internal error, cut/pasted the error to your Webmaster. If the Webmaster can't fix the problem, they can file an plugin issue (see the Support section).
The popup is not shown if:
Here is a list of all the possible errors. NAME is the uploaded file's name, PATH is where it was to be saved on the server.
create_post. The other uploaded files are still saved.
file extension not allowed, not saved: NAME - the
file extension is not an allowed image type.file type not allowed, not saved: NAME - the file
content is not an allowed image type.copy failed, not saved: PATH - the file could not be
copied to the uploads directory.not added to Media Library, file removed: PATH:
REASON - the file was copied, but could not be added to the
Media Library.post_template is not set for form ID - the form has
create_post: true, but no
post_template.post_template page not found: SLUG - there is no
page with that slug.ATTR-END not found in the template - the template
has an ATTR-BEGIN line with no ATTR-END line. The post is still made,
but all the blocks after ATTR-BEGIN are left out.wp_insert_post failed: REASON - WordPress could not
create the post.invalid expire-date: "VALUE" - expire-date is not
YYYY-MM-DD.