PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Password Protect a Post published by a GF form

  1. Hello,
    I rely on Gravity Forms to publish custom posts. It works very well ;-)
    Also, I would like to password protect posts published by my latest GF form.
    I don't see any option to do so out-of-the-box.
    I would very love to have some hints on the way to achieve so (hooks, for instance).
    Regards,
    Antoine

    Posted 10 years ago on Wednesday January 25, 2012 | Permalink
  2. +1

    Posted 9 years ago on Wednesday January 9, 2013 | Permalink
  3. David Peralty

    So you both would like to be able to create Password protected posts using Gravity Forms? How would you see that working? Would the user also set the password on those posts? It is potentially possible with our current hooks system, but I'd have to confirm with the developers.

    Posted 9 years ago on Thursday January 10, 2013 | Permalink
  4. I'm looking for something similar. Were you able to verify how to make this happen?

    I want to like to have the user specify the password to be used to protect the post submitted through Gravity Forms. I also have a need to generate an after the post is created and have that password appear in the email.

    Thank You

    Posted 8 years ago on Wednesday March 6, 2013 | Permalink
  5. @cyteworks, it looks like all you need to do to mark a post visibility as 'password protected' is set the post_password. You can do this with the gform_after_submission hook and the wp_update_post function.

    http://www.gravityhelp.com/documentation/page/Gform_after_submission
    http://codex.wordpress.org/Function_Reference/wp_update_post

    Set the post_password for the post to the password entered into your form. You can do it like this: http://pastebin.com/nuYBKSrJ

    Demo: http://gravity.chrishajer.com/password-protect-the-post-you-create/

    If you include {all_fields} in your notification, the email will include the password they entered.

    Posted 8 years ago on Tuesday March 12, 2013 | Permalink