• Resolved AWOL

    (@awol)


    Is it possible to have the post ID of where the form is placed as the title of the post saved by the form? I have tried a number of things, but it seems like there is a limitation of the CF7 plugin that prevents this, but I am hoping there is a way. I don’t want the user to be involved in the process, I just want it to happen programatically. Any help or suggestions most appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    sure. Use the ‘Hook with a filter’ mapping option on the title field,

    image

    the filter function provided passes the $post_id which you can then simply return.

    Thread Starter AWOL

    (@awol)

    Thanks for your answer, but I just want to check something; does it matter that the form is being saved as it’s own post type, because your graphic shows ‘Existing Post’? And does this mean that different fields can be mapped to different post types? Because I need to have one of the form entries mapped to the content field. This aspect confuses me greatly.

    • This reply was modified 3 years, 4 months ago by AWOL.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    does it matter that the form is being saved as it’s own post type

    no, not at all.

    And does this mean that different fields can be mapped to different post types?

    1 form is mapped to 1 post-type. It is possible to map 1 to many or many to 1, but this is more complex to achieve.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    PS: I will be releasing more tutorial videos on my channel, so subscribe if you want to get notified

    Thread Starter AWOL

    (@awol)

    OK, so let me get this straight; as it stands, if I want to have the post title of my form submissions to be the post id of the post they are embedded in, I use the “hook with a filter” code in my custom theme functions (do I just paste it as is, no need to add anything?) and I can still add one of my form fields as the post content in the mapping? If so, that’s perfect!

    Thread Starter AWOL

    (@awol)

    Hi @aurovrata , I think there may be something not quite right with your answer, after having just tried this. I do not want the post title of the post to be the post title of the form post, I want it to be the post ID (as in a number) to be the form post’s title. The reason is that this is guaranteed to be unique, whereas there is a good chance that two posts could have the same name/title, as these are being submitted by users.If as it seems this is not possible with the filter, I am guessing there might be a way of having it as a field in the form, but so far I have not found a way to do it. If I find a way to output the post id in the form, either as a field or perhaps a shortcode or something else, can your plugin use that to map as the title?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    code in my custom theme functions (do I just paste it as is, no need to add anything?)

    no, the code is meant to be a helper code, you still have to figure you the PHP code logic you need… as I said in my first answer, you need to return the id.

    and I can still add one of my form fields as the post content in the mapping? I

    sure, you can

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Post ID as Form post title?’ is closed to new replies.