• Resolved 0dre

    (@0dre)


    Hi,
    situation:
    I have a CPT Job and on its details page I have button “Apply for job” pointing to a form(gravity form and I also have Pods gravity forms Add-on). form opens on a new page.
    There is also a CPT User for well… users.
    And a CPT Applications created using Pods. Application post type has, among others, fields Job and User – both of them have type: Relationship and point to their CPTs

    What I’m trying to achieve is:
    1) Pass data from Job to apply form (job reference or ID, title, description, etc)
    2) Save form to Application CPT and map Job with passed job, User with current logged-in user, some data, passed from Job to application fields. (should be mapped in the background, without displaying anything to user)

    how can this be done? are there any tutorials explaining this mapping to CPTs on form form save?

    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    When you create a Form ‘feed’ to a Post Type in Pods using our Pods Gravity Forms Add-on, typically, that means you’re writing one post in the Custom Post Type you’re trying to create a post in.

    Since you’re trying to do something ‘advanced’ to replicate what can be done on the back-end, you’re going to have to think a little outside the box and that isn’t something we can exactly write a tutorial to handle.

    Basically, your application form needs to grab the ID of the user who is logged in to connect that application to the user, correct? So, you have the logged in user ID through Gravity Forms Merge Tags, it’s {user:ID} (https://docs.gravityforms.com/merge-tags/#user-meta)

    When you are saving a relationship to a post-type to something else, assuming you have a relationship field from Applications to Users, the value in that relationship field is the ID on the other side of the relationship. So what you’re saving to that field is the User ID.

    You would create a hidden field in your form, set default value to be {user:ID} or just specifically map that field to {user:ID} in the Feed to populate the record in the Pods Feed.

    That’s how the Feeds work.
    1) You create a form to populate a post,
    2) you create a Feed to the Pod using our Pods Gravity Forms Add-on,
    3) you map the fields in your form to the fields in your Pod. If you name all the fields ‘admin’ label with the actual field name from Pods, they’ll automatically be mapped for you

    If you want to pass information from an Job form into the form, pass those in the shortcode calling the form, with Query Variables or with filters. All of that is documented by Gravity Forms: https://docs.gravityforms.com/using-dynamic-population/

    If you have any additional questions to help you get that lightbulb moment, please feel free to drop onto our Slack Chat at https://support.pods.io/chat/

Viewing 1 replies (of 1 total)
  • The topic ‘link pods to cpts behind the scene’ is closed to new replies.