WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Register a Posts2posts connection via a Gravity Form? (7 posts)

  1. trickadee
    Member
    Posted 2 years ago #

    I've created a Gravity form for users to submit associated resources to a training module. This is done through CPTs for 'Associated Resources' and 'Training Modules'. The 'Gravity Forms + Custom Posts Types' plugin (love it!) manages the form posting to the CPT.

    The Associated Resources are associated through the Posts2Posts plugin (which is fabulous!). At the moment, a logged in user can make this association when editing the Training Module or Resources posts (great!) but they can't make this association when uploading a new resource on the front end through the Gravity form (not so great).

    The user is able to input the Resource title, URL and type of file into the Gravity form and push the data to a new 'Resource' post, but I can't figure out how the form can also register the Posts2Posts association.

    Any help? Please?

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. bradvin
    Member
    Posted 2 years ago #

    hi there

    I think you will need to write some custom code for this. The best way is to hook into the 'gform_post_submission' action (this is what the GF+CPT plugin hooks into to save taxonomies for a post)

    add_action('gform_post_submission', 'link_posts');
    
    function link_posts( $entry, $form ) {
      $post_id = $entry['post_id'];
      foreach( $form['fields'] as &$field ) {
        //get values from form fields
      }
    }
  3. trickadee
    Member
    Posted 2 years ago #

    Thanks for the start. I might need to pull someone in on this- a bit hard for me.

  4. Jake Spurlock
    Member
    Posted 2 years ago #

    Any updates here? I am looking to do the same thing...

  5. bradvin
    Member
    Posted 2 years ago #

    Hey Jake,

    I don't think this falls part of the Gravity forms + custom post type plugin. However, I am thinking about doing a separate plugin that does this linking, but it is not top of my list at the moment.

    What is the barebones functionality you are looking for and I will see what I can do

  6. Jake Spurlock
    Member
    Posted 2 years ago #

    Well, I would like the ability to generate a new post, and then at the same time, register connections for other posts. Like trickadee mentioned above, this can be done on the backend after a post is created, but I would like to keep this all on the frontend.

  7. trickadee
    Member
    Posted 2 years ago #

    Hi There,
    I still haven't got this up and running, it's a project I've parked for now. As Jake said, it's about creating connections on the front end.
    If you do write something, please let me know!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic