Reply To: How to find out what forms are using the plugin
April 5, 2022 at 10:10 am Reply
Support Manager
Hi Grant,
Thanks for your questions. I certainly understand how that can present an issue with so many forms. At this time, there’s nothing built into SyncS3 that would visually indicate a form has an S3 field. The only way to tell would be to open the form editor, which I understand is less than ideal in your case.
To make this easier, I went ahead and put together a code snippet for you to use. Add this to your theme’s functions.php file. It will add a column to the forms list, which shows a checkbox when a form contains a SyncS3 field. Feel free to customize it as you wish.
add_filter( 'gform_form_list_columns', 'em_gf_form_list_column_syncs3' );
function em_gf_form_list_column_syncs3( $columns ) {
$columns['syncs3'] = 'SyncS3';
return $columns;
}
add_action( 'gform_form_list_column_syncs3', 'em_gf_form_list_column_syncs3_data' );
function em_gf_form_list_column_syncs3_data( $item ) {
$form = GFAPI::get_form( $item->id );
$is_syncs3 = false;
if ( is_array( $form['fields'] ) ) {
foreach ( $form['fields'] as $field ) {
// AJAX Uploader type
if ( RGFormsModel::get_input_type( $field ) == 'syncs3_ajax_uploader' ) {
$is_syncs3 = true;
break;
} else if ( RGFormsModel::get_input_type( $field ) == 'fileupload' ) { // Standard upload field configured for S3
if ( ! empty( $field->enableS3Field ) ) {
$is_syncs3 = true;
break;
}
}
}
}
if ( true === $is_syncs3 ) {
echo '✅';
}
}