Introducing Abandoned Carts for LifterLMS

In version 1.0.3 of SyncsS3 for Gravity Forms, we introduced a couple new filters that allow you to apply custom logic on bucket names and file paths. These filters include syncs3_put_object_bucket_name, and syncs3_put_object_file_path.

With these filters, you can create more complex logic for determining which buckets file uploads, thereby overriding the default that you set within SyncS3.

You can also set a custom file path for the files. By default, SyncS3 places files into a folder within your bucket that looks like form-{form_id}, where form_id is the ID of your Gravity Form. The syncs3_put_object_file_path lets you override that default, and create a nested folder structure for your files.

Customize the Amazon S3 Bucket Name in SyncS3

add_filter( 'syncs3_put_object_bucket_name', 'customize_syncs3_bucket_name', 10, 6 );
/**
 * Custom logic to set the bucket name in SyncS3 for Gravity Forms
 *
 * @param string 	$bucket_name 		Bucket name
 * @param string 	$file 			Local file URL when uploaded
 * @param string 	$file_name 		Name of uploaded file
 * @param int 		$field_id 		ID of the fileupload field
 * @param int 		$form_id 		ID of the form
 * @param array 	$entry 			Entry data
 *
 * @return string 	Bucket name
 */
function customize_syncs3_bucket_name( $bucket_name, $file, $file_name, $field_id, $form_id, $entry ) {
	// Custom logic here
	return $bucket_name;
}

Customize the Amazon S3 File Path in SyncS3

add_filter( 'syncs3_put_object_file_path', 'customize_syncs3_path', 10, 6 );
/**
 * Custom logic to set the bucket name in SyncS3 for Gravity Forms
 *
 * @param string 	$path 			File path to return. Make sure the path ends with $file_name.
 * @param string 	$file 			Local file URL when uploaded
 * @param string 	$file_name 		Name of uploaded file
 * @param int 		$field_id 		ID of the fileupload field
 * @param int 		$form_id 		ID of the form
 * @param array 	$entry 			Entry data
 *
 * @return string 	Bucket name
 */
function customize_syncs3_path( $path, $file, $file_name, $field_id, $form_id, $entry ) {
	// Custom logic
	$path = "testing/new/{$file_name}"; // Make sure the new path includes the file name
	return $path;
}

These code snippets can be placed in a custom functions plugin, or your theme’s functions.php file.

0 Comments

Leave a Reply

Your Cart
Your cart is currently empty.
Open Cart

How do you build WordPress websites?

Are you into using page builders to create websites and earn income? That's what we love doing, too! That's why we build extensions for the most popular WordPress page builders - to help you build awesome websites and make more money.

If you enjoy the same things, we'd love to have you as part of the Elegant Modules community. Let's get to know each other!

Interests

Welcome! We're so excited to get to meet you, and look forward to chatting with you soon.