Our customers have requested it many times. Today, we are excited to introduce a new feature to SyncS3 we think you’re gonna love! “Direct to S3” sends your file uploads (submitted via Gravity Forms) directly to your S3 bucket without ever hitting your server. This allows you to bypass your server’s limitations, such as file sizes or timeouts. Now you can upload 2GB video files without any complaints from your server! This new feature is available in SyncS3 version 1.6.0.

Why Would You Need Direct to S3?

Primarily due to server limitations. For example, we have plenty of customers who host their websites on WPEngine. However, given WPEngine’s limitations on file uploads, uploading things like large video files can be very difficult. SyncS3 steps in with Direct to S3 to completely bypass WPEngine’s servers to upload these kinds of files to your S3 buckets.

Aside from getting around server limitations, the Direct to S3 feature also improves the user experience of your form by providing a snappier upload process. It includes a progress bar to let users know how far their uploads have made it, and can upload files while the user finishes the rest of the form.

Getting Started with Direct to S3

The “Direct to S3” feature is contained within a new field. This field can be added to your forms like normal in the Gravity Forms form editor.

SyncS3 "Direct to S3" upload field

The new uploader uses special S3 settings and configurations to upload files directly from the browser to your S3 bucket. To ensure a proper setup, first follow these steps:

1. Make sure you have created your bucket. Note your bucket’s region, as you will need it in the next step.

2. In the Amazon Cognito console, create an Amazon Cognito identity pool using Federated Identities with access enabled for unauthenticated users. This Identity must be in the same Region as your S3 bucket, so be sure to select the correct region. You need to include the identity pool ID in the code to obtain credentials for the browser script, so copy it to your clipboard.

3. In the IAM console, find the IAM role created by Amazon Cognito for unauthenticated users. Add the following policy to grant read and write permissions to your S3 bucket (replace BUCKET_NAME with your bucket’s slug).

   "Version": "2012-10-17",
   "Statement": [
         "Effect": "Allow",
         "Action": [
         "Resource": [            

4. In your bucket’s Permissions settings, add the following CORS policy to allow uploads from the browser:

        "AllowedHeaders": [
        "AllowedMethods": [
        "AllowedOrigins": [
            "*" // You can replace this with your domain to restrict uploads to only those originating from your website.
        "ExposeHeaders": [

After you’ve configured everything in your AWS account, come back to your field settings and insert your Identity Pool ID. You can also set the maximum number of files for the field, and the accepted file types (e.g. .pdf).

Finally, select the upload action. This tells SyncS3 when to upload the files. You can choose between File Select or Form Submit. File Select uploads files as soon as the user selects them. This is perceivably faster because the upload occurs right away, and the user can finish the rest of the form while the upload completes. However, it can result in uploaded files for incomplete submissions.

The Form Submit option uploads files when the user submits the form. Since the user has completed the form at this point, they’ll have to wait while the files are uploaded. This seems like a slower process for the end user, but it ensures you’re not hosting files for incomplete submissions.


The “Direct to S3” feature does its business asynchronously, so files are uploaded before an entry is created. If you’re using SyncS3 filters to customize a file’s path, these filters won’t work with the “Direct to S3” uploader because the upload doesn’t occur through your server. As a result, you’ll need to rely on some custom Javascript and user input to customize the file path. Here’s a snippet you can use to get started:

add_action( 'wp_head', 'add_custom_setS3Path_js', 99 );
 * Add a custom Javascript function to create the file path in your S3 bucket.
 * This function will need adjusted to fit your requirements and naming conventions.
function add_custom_setS3Path_js() {
		var setS3Path = function(file, formId) {
			var input1 = document.getElementById("input_" + formId + "_1").value;
			if ( "" != input1 ) {
				input1 += "/";
			var path = input1 + file.name;
			return path;
add_filter( 'syncs3_ajax_uploader_object_path_js', 'function_name', 10, 3 );
 * Runs the custom Javascript function to determine a file path.
 * Default value is "file.name". This will use the file name, and insert it in the root of your bucket.
 * @param  string 	$js    		Custom Javascript
 * @param  object 	$field 		SyncS3_AJAX_Uploader object
 * @param  array 	$form  		Form data
 * @return string
function function_name( $path_js, $field, $form ) {
	$path_js = "setS3Path(file, {$form['id']})";
	return $path_js;

Divi makes it possible to achieve almost any layout, insert almost any content element, and style things in almost any way. But what about payment forms? What about payment forms within modal popups?

Divi Payment Form Modal Popup - Divi Builder

By default, Divi doesn’t have options for modals or payment forms. That’s why we’ll be using our Payments for Divi plugin, and the Popups for Divi plugin. In just three simple steps, we’ll have an awesome looking modal popup that contains a custom payment form.

Step 1: Create a Button to Launch the Payment Form Modal

Once you’ve installed both the Payments for Divi and Popups for Divi plugins, head over to your page, and enable the Divi Visual Builder. Go ahead and add a button wherever you want. I’ve added a button with the text of “Order Now.”

Divi Payment Form Modal Button Settings

The main requirement for the button is the “Button Link URL” setting. This setting normally takes a URL for the button link. However, to launch our payment form modal popup, we’ll use a hash link. A hash link looks like #id_of_target_element, where id_of_target_element will be the ID of our modal’s section. This tells your browser to open the modal when the button is clicked.

On my test site, I’ve used #order as the Button Link URL, which means my modal section will need to have an ID or order.

Step 2: Create a Modal Popup Section for the Payment Form

Next, you create the modal popup section, which is done with the Popups for Divi plugin. To create the modal, just add a new section to your page. I added mine at the bottom, but it doesn’t matter where you add it because the section will be hidden until the modal is toggled open.

To add my payment form popup, I styled my new section with a full row, and limited the row to 400px in width. I also made sure it was centered in the page.

Divi Payment Form Modal Popup Settings

To enable the section as a popup, the Popups for Divi plugin adds a “Popup” tab to the section’s settings. Click that tab. Under the General dropdown, toggle the setting to enable the section as a popup. Then, give it a “Popup ID” of whatever you used in your Button Link URL above, excluding the # symbol. Since I added #order as my button link, I’ll give the popup an ID of order.

After the basic requirements are set, you can style and configure your popup however you wish.

Step 3: Add the Payment Form

Finally, we’ll add the payment form to the popup section. Simply add a new module to your section’s row, and select the Payment Form module. You can read more about how to create payment forms for Divi here. I also added a text module, with a title for the modal. After saving, this is what my payment form modal looks like.

Divi Payment Form Modal Popup

Send File Uploads Straight to Amazon S3

SyncS3 for Gravity Forms lets you send your file uploads to any Amazon S3 bucket. Store your images, videos, and other files on Amazon's high quality infrastructure.

WooCommerce offers a full-featured e-commerce platform, right within WordPress. It turns a basic WordPress website into an e-commerce application capable of selling physical products, digital downloads, subscriptions, and basically anything you can think of. It even has a REST API if you want to get super technical and fancy.

Long story short, WooCommerce is incredibly powerful. Potentially lost in its sea of features is the ability to redirect customers when they take an action. A small feature, sure. But also an underutilized tool that can help boost revenue by promoting cross-sales and upsells.

Take, for example, when a customer completes a purchase on your WooCommerce website. They’ve browsed your website, selected a product of interest, and paid you money for it. You’ve won that hard-earned sale. The customer trusted you enough to send you money. So what better time than after purchase to upsell the customer on another, related product?

Using WooCommerce Subscriptions?

Bulk Update WooCommerce Subscriptions lets you modify the pricing and terms of your existing WooCommerce Subscriptions in bulk. Change thousands of subscriptions in just minutes!

The best example of this that comes to mind is Vistaprint. If you’ve never shopped at Vistaprint, they sell all kinds of awesome products, from business cards and stationary, custom mugs, pens, shirts, and tons more. Each time you buy something on Vistaprint, you land on a thank-you page that gives a limited-time offer to do things like increase the quantity of what you purchase, or purchase other related items at a discount.

This tactic is incredibly effective. Personally, I fall for it almost every time. But I’m a sucker for a good deal – who could resits doubling your order for just 50%?!

WooCommerce Product Redirects

Redirecting in WooCommerce

So how can you do something like this in WooCommerce? Well, with redirects of course! The Custom Redirects for WooCommerce plugin allows you to set up custom redirects for any product, product tag, and/or product category. The redirect types include add-to-cart and after-purchase. The former occurs when a customer adds a product to their cart, while the latter occurs after a customer completes payment.

Drip & Protect Content with WooCommerce

Using WooCommerce Memberships to power your memberships website? See how easily you can protected and drip your memberships content…VISUALLY.

Since you have granular control over the redirect destinations, you can set up custom landing pages with special offers and promotions, then redirect your customers to those pages after they buy certain products.

Using the Vistaprint example, you could create a custom thank-you page that includes awesome deals on things like branded mugs, pens, and tee shirts. Then, when a customer buys business cards from your website, you can send them to this landing page!

WooCommerce Product Redirects List

Gutenberg makes it super simple to create your content, such as pages and blog posts. As WordPress and Gutenberg continue to grow, the new editor will be extended to work on other parts of your site, so the possibilities will only continue to grow!

Using WordPress’s native blocks and third-party blocks, you can achieve unique layouts, filled with design elements that are beautifully crafted by top-notch block developers and designers.

What is CoBlocks

CoBlocks, founded by Rich Tabor at GoDaddy, is a suite of blocks for the WordPress editor. It includes a bunch of blocks that not only help content creators add new features to their websites, but they look flat out awesome!

In this post, we’ll look at how you can use CoBlocks with Ad Injector to bring the same powers of Gutenberg to your WordPress post archives, such as Blog page, custom post type listings, and even WooCommerce product grids!

What is Ad Injector?

With Ad Injector, you can use Gutenberg to create content like advertisements, promotions, calls to action, and much more. You can then insert that content anywhere within your blog page.

For example, say you’re launching a new product, and you’d like to display a promotional call to action after the first blog post on your Blog page. You can use Ad Injector to create the ad, insert it after the first post, and even schedule it for when to start and/or end. You can use CoBlocks to make it look great!

Here’s what we’ll be creating…

Ad Injector with CoBlocks

Here, we’ve created a promotional call to action using CoBlocks and Ad Injector, and have inserted it after the first post on the Blog page.


You won’t need anything special here – just CoBlocks and Ad Injector!

CoBlocks is a free plugin you can download from your WordPress admin, or upload the zip file.

Ad Injector is available from Elegant Modules, with a Basic license starting at just $39. You can download the plugin’s zip file, and upload it in your WordPress admin. Make sure to add your license key in the Ad Injector settings to ensure you get access to automatic updates and support.

Creating the Promotion

After both CoBlocks and Ad Injector are installed and activated, you can create your promo. In your WordPress admin, in the admin menu on the left side of the screen, click on Ads –> Add New.

Creating a new ad is just like creating any other post or page in Gutenberg. For our example, we’ll be using the “Media Card” block available in CoBlocks. The setup will look similar to this:

CoBlocks Media Card

The Media Card block looks great, and is simple to configure. We just need to select our image, and add a title and description. You can also set thing like a background color, the amount of padding, card or image shadows, and more.

After you’ve added the content for your promo, it’s time to insert it into your blog with Ad Injector.

Inserting the Ad

The Ad Injector settings next. Since we want to display the promo after the first post in our blog, we’ll select “Posts” as our post type, and enter “1” as the position. You can also set a start and end date for your ad, if desired. Your settings will look like…

Ad Injector ad settings

After designing your promo and configuring the Ad Injector settings, you can save and public your ad. You can now create any kind and any number of promos you’d like, and insert them into whichever post type archives you wish. Use Ad Injector to insert things like email opt-ins, product upsells, and anything else you can do in Gutenberg!

Want to Add Custom Promos in Your Blog?

Check our Ad Injector, a WordPress plugin that lets you build, schedule, and insert custom promotional content right into your blog. It also supports custom post types and WooCommerce product grids!

If you need to use instance profiles and IAM Roles to send Gravity Forms file uploads to an Amazon S3 bucket, SyncS3 for Gravity Forms includes a filter for overwriting the S3 client object. This will allow you to assume an IAM user role, and configure the S3 client to use that role’s credentials to upload files.

Using Amazon’s sample code in Assuming IAM Roles in another AWS account, we’ll adapt it to work with SyncS3. Note that some of this code needs modified to use your own AWS credentials.

add_filter( 'syncs3_s3_client', 'my_iam_syncs3_s3_client', 10, 3 );
 * Overwrites the S3 client to use an IAM user's credentials.
 * @see https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_assume_role.html#assuming-an-iam-role-in-another-aws-account
 * @param  object   $client     S3Client
 * @param  array    $config     Default configuration data
 * @param  mixed    $entry      Entry data aray, if available, else empty
 * @return object S3Client
function my_iam_syncs3_s3_client( $client, $config, $entry ) {
	// This needs modified to fit your account
	$stsClient = new Aws\Sts\StsClient([
		'profile' => 'default',
		'region' => 'us-east-2',
		'version' => '2011-06-15'
	// This needs modified to fit your account
	$result = $stsClient->AssumeRole( array(
		'RoleArn' => 'arn:aws:iam::123456789012:role/xaccounts3access',
		'RoleSessionName' => 's3-access-example',
	) );
	// Create the new S3 client using the IAM user
	 $client = new Aws\S3\S3Client([
		'region' => $config['region'],
		'credentials' => array(
			'key'    => $result['Credentials']['AccessKeyId'],
			'secret' => $result['Credentials']['SecretAccessKey'],
			'token'  => $result['Credentials']['SessionToken']
	return $client;

If you run an e-commerce website, setting up Google Analytics E-Commerce Tracking is something you should do sooner rather than later. E-Commerce Tracking will provide you with valuable insights on where your sales are coming from, such as which referrers and pages are generating the most revenue.

In this post, we’ll take a look at how to set up Google Analytics E-Commerce Tracking in Easy Digital Downloads. Since EDD doesn’t have an official add-on for enabling this feature, we set out to enable it on our own website with some custom code. Here’s how we did it.

Pre-Requisites for Google Analytics E-Commerce Tracking

Before looking at the code to add Google Analytics e-commerce tracking, you need to make sure everything is in place for it to work.

First, you have to have a Google Analytics account, and the general tracking snippet installed on your website. We’ll assume you have one, so we won’t cover the basic Google Analytics integration. If you need help with this step, see this article on How to Set Up Google Analytics in 5 Simple Steps.

Assuming you now have your basic Google Analytics integration up and running, the next step is to enable E-Commerce Tracking for the property/website.

After logging in to your GA dashboard, click the “Admin” menu item (the gear icon). This will take you to a screen that looks like this.

Google Analytics admin

In the Property column, select the correct property. This is the website on which you want to enable e-commerce tracking.

Next, in the View column, select “Ecommerce Settings.” This will open up the following settings.

Google Analytics Enable E-Commerce Tracking

The “Enable Ecommerce” setting will likely be off, so toggle it on, then save your change.

The Code

Now that your website supports GA e-commerce tracking, let’s actually add the code to tell GA when it should record e-commerce data.

add_action( 'wp_footer', 'em_load_ga_ecommerce_event_tag' );
 * This loads the script required for sending payment conversion to Google
 * @return void
function em_load_ga_ecommerce_event_tag() {
	// Bail if not on payment confirmation
	// $_GET['payment_key'] is not available on new purchases (only when later viewing receipt)
	if ( ! edd_is_success_page() || ! empty( $_GET['payment_key'] ) ) {
	global $edd_receipt_args;
	$payment = get_post( $edd_receipt_args['id'] ); // Post data for payment ID
	$meta = edd_get_payment_meta( $payment->ID ); // Meta data about the transaction
	// Get some transaction data
	$payment_obj = new EDD_Payment( $payment->ID );
	$total = $payment_obj->total;
	if ( isset( $meta['cart_details'] ) ) {
		$cart_items = $meta['cart_details'];
	$items = array();
	if ( ! empty( $cart_items ) ) {
		foreach ( $cart_items as $key => $product ) {
			$items[] = array(
				'id' => $product['id'],
				'name' => $product['name'],
				'sku' => edd_get_download_sku( $product['id'] ),
				'price' => $product['item_price'],
				'quantity' => $product['quantity']
		gtag('event', 'purchase', {
		  "transaction_id": "<?php echo $payment->ID; ?>",
		  "affiliation": "<?php bloginfo( "name" ); ?>",
		  "value": <?php echo $total; ?>,
		  "currency": "USD",
		  "tax": 0,
		  "shipping": 0,
		  "items": <?php echo json_encode( $items ); ?>

You can add this code snippet to your theme’s `functions.php`. Let’s review what all this does.

  1. The first check is that the user is on the purchase confirmation page, but only if it’s a new purchase. Since EDD uses the same page for both new purchases and viewing the receipt of previous purchases, this check helps avoid duplicate recordings in the event that a customer reviews the payment receipt later on.
  2. Next, it loops through all of the products in the payment, and assembles data to send to Google Analytics. This is how GA knows which products are being sold.
  3. Finally, it loads a bit of Javascript to send a purchase event to Google Analytics. We load this in the footer to ensure that the Google tag manager script is loaded (that should be loaded in the header). We tell GA about the payment, including its total, transaction/payment ID, our currency, and the payment’s items.

Now, when a customer completes payment and is sent to the purchase confirmation page, the Google Analytics tag manager will send the purchase data for recording in your GA account.

Our WordPress content protection modules can now revoke dripped membership content! In addition to dripping content after any given amount of time, you can now set that content to become unavailable after any given amount of time.

This allows for drip scenarios where you charge for a set period of access, but stagger the availability of your content. For example, let’s say you sell a course and charge users for one month of access. The course, though, has four different sections, where each section is available in order – one each week. Part 1 is available in week 1, Part 2 in week 2, etc. With content revocation, you can now revoke access to Part 1 in Week 2, etc.

Expire Access to Membership Content

To begin using the content revoking feature, simply enable content dripping, enter when the content should become available, and set how much time should pass before it is revoked. Using our Gutenberg integrations, the settings would look like this.

WordPress revoke membership content

The new feature to revoke access to membership content is available in all of our content protection modules. Users of WooCommerce Memberships, LifterLMS, Paid Memberships Pro, and Easy Digital Downloads can drip and revoke content using Elementor, Divi, Beaver Builder, or Gutenberg!

Want to find the perfect content protection module for your website? Try our simple setup wizard. Just select which page builder and membership platform you use, and we’ll show you the right module.

SyncS3 version 1.4 was just released. The new version features support for Gravity PDF!

If you’re not familiar with it, Gravity PDF is a sweet plugin for Gravity Forms that automatically generates PDFs of form entry/submission data. This is very handy if you need to store or distribute copies of entry data. The PDFs are self-hosted, meaning there’s no need for a third-party service to generate or host your PDFs; everything is handled right on your own server and website.

While it’s great to handle the PDF generation on your own site without any third-party dependencies, you may want to store the PDF files externally, especially if you process a lot of submissions. Storing the files on Amazon S3, for example, gives you flexibility in distributing the files, and can free up a lot of disk space on your server.

SyncS3 1.4 integrates with Gravity PDF to offload PDF files to any S3 bucket you wish. If you’re using SyncS3 to offload file uploads, it will default to using your form’s SyncS3 settings (if set), or the global SyncS3 settings. If you want to push file uploads to one bucket and your PDF file to another, just overwrite the account/bucket in the PDF settings.

SyncS3 + Gravity PDF Support

Uploading PDF files to S3 is as easy as checking a box. Head over to your form’s PDF settings, click the Advanced tab, and scroll down to the Upload PDF to S3 setting. Enable that setting, select whether you’d like the local PDF to be removed, and configure the account and bucket settings as needed.

One important thing to note is that you need to set the Always Save PDF setting to “Yes.” This tells Gravity PDF to actually save a PDF file to disk, rather than always generating PDFs on the fly. These “hard” copies are needed to upload to S3.

Each time a PDF is generated, SyncS3 will push it to your S3 bucket. If you enabled the Delete Local PDF setting, the file will be deleted on your server, freeing up disk space.

Send File Uploads Straight to Amazon S3

SyncS3 for Gravity Forms lets you send your file uploads to any Amazon S3 bucket. Store your images, videos, and other files on Amazon’s high quality infrastructure.

Gravity PDF users can select from a variety of different pre-made templates to use for different layouts and designs in their PDFs. The Gravity PDF team also offers bespoke templates tailored specifically to your requirements.

DigitalOcean Spaces is an object storage service designed to make it easy and cost effective to store and serve large amounts of data.


SyncS3 for Gravity Forms now supports syncing file uploads with DigitalOcean Spaces!


Spaces is a low-cost data storage service from DigitalOcean. For just $5 per month, you get 250GB of storage, 1TB of outbound transfers, and unlimited uploads. Perfect for use as a CDN to host files such as images, videos, large PDFs and much more! This allows businesses to scale their websites’ performance at greatly reduced prices and complexity.

Spaces + Gravity Forms

In version 1.3 of SyncS3, we added a new setting to add your own endpoints to your file uploads, overriding the default. DigitalOcean provides you with a Spaces endpoint that you can use with SyncS3 to send files to your Space instead of directly to Amazon S3.

Send File Uploads Straight to Amazon S3

SyncS3 for Gravity Forms lets you send your file uploads to any Amazon S3 bucket. Store your images, videos, and other files on Amazon’s high quality infrastructure.

To sync file uploads with Spaces, you’ll need your space’s keys (access and secret), bucket name, bucket region, and DigitalOcean Spaces endpoint. Plug these into the SyncS3 settings in your file upload field (or your form or global settings).

Your settings will something like this.

SyncS3 settings for DigitalOcean Spaces.

Now, when a file is uploaded via Gravity Forms, it will be pushed to your DO Spaces bucket!

For more information on retrieving bucket information for your Spaces bucket, here are a couple help links:

By default, SyncS3 for Gravity Forms uploads files to Amazon S3 with private file permissions. This means the only way to access them is with a signed URL – SyncS3 signs the URLs in the admin so you can easily view them. If you want to offer public access to the files, such as viewing images or downloading zip files, you’ll need to adjust the files’ permission settings.

The Bucket Policy

To change a file’s permission settings, you first need to ensure that access to the file isn’t denied at the bucket level via the bucket policy. The easiest solution may be to not have any bucket policy. This will let you set access permissions on a per-file basis. However, if you have a reason for a bucket policy, you’ll need to adjust it to exclude the files you want to keep public.

Amazon S3 bucket policy

Here’s an example bucket policy that denies access to bucket files, unless requested from an authorized website.

    "Version": "2012-10-17",
    "Id": "http referer policy example",
    "Statement": [
            "Sid": "Allow get requests referred by mywebsite.com.",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my-bucket/*",
            "Condition": {
                "StringLike": {
                    "aws:Referer": "https://mywebsite.com/*"
            "Sid": "Explicit deny to ensure requests are allowed only from specific referer.",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my-bucket/*",
            "Condition": {
                "StringNotLike": {
                    "aws:Referer": "https://mywebsite.com/*"

This policy denies access to any file in the my-bucket bucket, unless the request is from https://mywebsite.com. You’ll need to modify the policy to set your bucket name and website URL. You can also modify the Resource path if your public files are saved to a subfolder.

SyncS3 Filter

It is currently on our development roadmap to build a feature into SyncS3 that lets you select a canned ACL option for your file uploads. Until then, you can use the syncs3_put_object_acl filter to override the file’s ACL permission.

add_filter( 'syncs3_put_object_acl', 'em_syncs3_object_acl', 10, 6 );
 * Filters the Access Control List for an object.
 * For possible choices, see https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl.
 * @param  string 	$acl       	ACL (default: 'private')
 * @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
function em_syncs3_object_acl( $acl, $file, $file_name, $field_id, $form_id, $entry ) {
	// Logic here if needed
	return 'public-read';

This snippet sets all files uploaded by SyncS3 to public-read. You’ll need to add your own logic if needed. The filter make available data about the entry, form, and field so you can run your own logic.

After you’ve set your bucket policy and filtered the file’s ACL permission, files will be accessible according to your custom permissions. If you’ve set your bucket policy and ACL to allow for public-read access, you can link to the files with the stored S3 URLs, and user won’t get the “Access Denied” XML error they’d normally receive when the file is set to private.

SyncS3 for Gravity Forms allows you to send file uploads to any Amazon S3 bucket when your forms are submitted. Each time an entry is created, those files are sent to S3, and a reference to the file is saved in the entry on your website.

If you regularly find yourself deleting entries from your website, you may want to also delete the files that were sent to Amazon S3. If you don’t have a specific reason to keep the files, why pay for the space they take up?

By default, SyncS3 does not have a feature to automatically remove the files when an entry is deleted. This is by design, because we’d rather be safe and not remove files. Instead, you can elect to remove the files by using the following code snippet.

add_action( 'gform_delete_entry', 'syncs3_remove_s3_urls_on_delete_entry' );
 * Delete an entry's files from Amazon S3 when an entry is deleted.
 * This fires before the entry is fully deleted, so the entry meta is still available.
 * @param  int		$entry_id 		Entry ID to be deleted
 * @return void
function syncs3_remove_s3_urls_on_delete_entry( $entry_id ) {
	$s3_urls = gform_get_meta( $entry_id, 's3_urls' );
	if ( ! empty( $s3_urls ) ) {
		foreach ( $s3_urls as $field_id => $urls ) {
			if ( ! empty( $urls ) ) {
				foreach ( $urls as $url ) {
					if ( ! empty( $url['file_url'] ) ) {
						syncs3_delete_file( $entry_id, syncs3_get_url_parts( $url['file_url'] )['file_name'] );

This code runs when an entry is deleted from your website’s database. Note that this is not the same as moving an entry to the trash. For this code to do its job – delete the files from S3 – you need to trash the entry, and then empty your trash.

Also, for this code to work, you need to be running SyncS3 Pro 1.2.0. Prior to 1.2.0, not enough information was saved about each file to remove them. Therefore, this will only work for deleting entries that were created on SyncS3 1.2.0 or later.

Your Cart
Your cart is currently empty.
Open Cart