Support » Plugin: Gravity Forms - Update Post » Using in combination with ACF Repeater

Viewing 2 replies - 1 through 2 (of 2 total)
  • This… isn’t simple, you can use the save the hook though to reformat the information for ACF. I have to say, though, why? There are very few good reasons, to me, to keep switching between ACF and GF.

    ACF is a far superior way to update posts on the back end AND front end. Use acf_form()….

    I can’t stress this enough. ACF will save you work as you update fields and is just a more solid solution for updating posts unless you have a really good reason…

    ALL of that said, something like this should work to go over a list fields and convert it to repeater. You will need to customize it, of course. For example, this only has one field “name”, if you have more, you will need to add them as well.

     * Update some info to fit ACF formatting.
    add_action( 'gform_after_submission', 'custom_gf_to_acf', 10, 2 );
    function custom_gf_to_acf( $entry, $form )
    	// Update a list to repeater format
    	// - GF list field name is "input_8"
    	// - meta key is "areas_of_expertise"
    	// - list field key is "name"
    	if (! empty($_POST['input_8']) )
    		$post_id    = $entry["post_id"];
    		$field      = $_POST['input_8']
    		$count      = 0;
    		$parent_key = 'areas_of_expertise';
    		foreach ( $field as $item )
    			$key = $parent_key . '_' . $count . '_name';
    			update_user_meta($user_id, $key, $item);
    		update_post_meta( $post_id, $parent_key, count($field) );

    Hi @jcow
    Thank you very much for your answer.

    Let me explain you what I’m trying to do:

    I’m working on a job-board like theme as a personal project, it has a lot of more things though.

    I have this CPT “job”, it has a repeater field called “applicants” which is intended to store the applicant USER ID and a cover letter.

    When the job is published is my idea for when the logged in user clicks on the job to see it’s details to send GET variables post-ID and USER-ID to the detail page. Here is when your plugin comes into scene.

    I place a form taking that’s post data (like if the user were editing it). but title, post id, user ID (with no duplicates) which populates taking the GET data. These will be hidden fields, the only field that is visible to the user is the cover letter. What it will be doing basically then is to add a repeater row with it’s user ID and cover letter.

    I was able to do this actually, but each time I submit, the repeater sub-fields are updated instead of adding a new row with this info.

    With this way, on the employer’s front end control panel, I can take the applicant user ID to create a repeater loop and pull all the applicants’ data to show the employer whom applied. And will also send an email through GF.

    I tried with the front end form of ACF but it actually shows all the data already stored on that repeater to the front end, so the users will be seeing all the applicants.

    I know this is probably NOT the BEST solution for this issue, but I’m not an advanced coder and considering my abilities this is the closest I could think about to get closer to my goal.

    Thanks a lot for your answer and if you have any council that could help me to achieve this I will be eternally thankful.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using in combination with ACF Repeater’ is closed to new replies.