Hello again @shayno90 !
Got some good news, our SLS team have created a snippet for this case:
<?php
/**
* Plugin Name: [Forminator] - Map ACF to upload field.
* Plugin URI: https://wpmudev.com/
* Description: Map ACF fields to upload field of Forminator when adding meta user.
* Author: Abdoljabbar Bakhshande
* Author URI: https://wpmudev.com/
* Task: SLS-3140
* License: GPLv2 or later
*
* @package WordPress
*/
if ( ! defined( 'ABSPATH' ) || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
return;
}
add_filter( 'forminator_replace_form_data', 'forminator_mu_map_acf_upload_field', 10, 4 );
function forminator_mu_map_acf_upload_field( $content, $data, $fields, $original_content ) {
if ( 'registration' === $data['form_type'] && ! empty( $original_content ) && empty( $content ) ) { // Check if it is registration form.
$form_id = $data['form_id'];
$email = $data['email-1'];
$original_content = str_replace( array( '{', '}' ), '', $original_content ); // Remove { and }.
$entry_model = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id ); // Get latest entry.
if ( $entry_model->meta_data['email-1']['value'] === $email ) { // Check if email is same.
if ( isset( $entry_model->meta_data[ $original_content ] ) ) { // Check if field exists.
$content = $entry_model->meta_data[ $original_content ]['value']; // Get value.
if ( is_array( $content ) && isset( $content['file'] ) ) { // Check if file exists.
$file_url = $content['file']['file_url']; // Get file url.
$content = attachment_url_to_postid( $file_url ); // Get attachment id because ACF file field only accept attachment id.
}
}
}
}
return $content;
}
Please copy the above code to a file and place it in wp-content/mu-plugins – the filename can be anything, but please make sure the extension is .php
Once that’s done, please also enable the option “Show files in media library” on the upload field on the form as it will be necessary for the snippet to work.
In ACF you can use any of the field types: image or file.
Best regards,
Pawel