Navigation überspringen

[Gelöst] Images and repeater URL via FluentForms to Toolset custom fields

This support ticket is created vor 1 month, 3 weeks. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 1 reply, hat 1 Stimme.

Zuletzt aktualisiert von Minesh vor 1 month, 3 weeks.

Assistiert von: Minesh.

Author
Artikel
#2846546

This is a follow-up for this ticket: https://toolset.com/forums/topic/images-and-repeater-url-via-fluentforms-to-toolset-custom-fields/

I got a reply from Fluent Forms support:

Fluent Forms provides a hook that runs after a submission is created, which can be used to access and normalize the submitted data as required by Toolset.
fluentform/submission_inserted
Please note that this requires custom PHP implementation, as this behavior is outside Fluent Forms’ default data handling.
We have also provided the documentation regarding these submission-related hooks for your reference. versteckter Link

#2846568

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see they shared the following hook:
=> versteckter Link

add_action('fluentform/submission_inserted', function($submissionId, $formData, $form) {
   // Do whatever you want with the new submission
}, 10, 3);

So, you can use something like this:

add_action('fluentform/submission_inserted', function($submissionId, $formData, $form) {
  if ($form->id==32) {
              
        $field_slug = 'media-gallery';
  
        $field_content = $_POST['wpcf-'.$field_slug];
              
            $sort_order = array();
              
             
            delete_post_meta($submissionId,'wpcf-'.$field_slug);
        
            foreach($field_content as $k=>$v):
                $sort_order[] = add_post_meta($submissionId,'wpcf-'.$field_slug,$v);
            endforeach;
     
            update_post_meta($submissionId,'_wpcf-'.$field_slug.'-sort-order', $sort_order);
        
    }

}, 10, 3);

Where make sure that the fluentform sends the full image URL with $_POST object.