Allow vendors to upload only specific file types in EDD Frontend Submissions

Easy Digital Downloads - Front-End Submissions - Allow only specific mime types upload

Frontend Submissions is an add-on that turns Easy Digital Downloads powered WordPress website into a complete multi-vendor marketplace. Based on your marketplace, you may need to restrict the certain file type uploads or allow specific file types upload only for your vendors.

I am sharing a code snippet that I just have written, and implemented on one of my client’s EDD FES website. Inserting it into WordPress theme’s functions.php will restrict vendors to upload any other file types and allow only zip file type upload.

// FES form field name : Prices and Files
add_filter( 'upload_mimes', 'dcg_restrict_mime_types', 1, 1 );
function dcg_restrict_mime_types( $mime_types )
{
$user = wp_get_current_user(); // get the current user
// if user is shop vendor or a shop manager
if ( in_array( 'shop_vendor', (array) $user->roles ) || in_array( 'shop_manager', (array) $user->roles ) ) {
// add the mime types you want to allow to upload
$mime_types = array(
'zip' => 'application/zip',
);
// Use unset to remove specific mime types uploads.
// unset( $mime_types['xls'] ); // Remove .xls extension
// unset( $mime_types['xlsx'] ); // Remove .xlsx extension
// unset( $mime_types['docx'] ); // Remove .docx extension
return $mime_types;
}
}

view raw
functions.php
hosted with ❤ by GitHub

Have you any better solutions? I would love to read your comments.

Easy Digital Downloads – Extra note(s) On Checkout

Easy Digital Downloads - Extra note(s) On Checkout


Version:1.1
Requires:3.5 or higher
Compatible up to:5.5.1
Released:04 January 2017
Downloads:968
Last Updated:31 August 2020
Ratings:
0
(0 star out of 5)

Description:

This WordPress plugin is Easy Digital Downloads add-on/extension, adds ‘Extra note(s)’ textarea to the checkout screen for buyers to add notes about their order.

This plugin will…
– Adds ‘Extra note(s)’ textarea to the checkout screen
– Adds {extra_note} email tag to show ‘Extra note(s)’ data in either the standard purchase receipt or admin notifications

This plugin doesn’t have any settings/options. Just Install, Activate, and Boom!

Installation:

  • 1. Upload the ‘edd-extra-notes-on-checkout’ folder to the ‘/wp-content/plugins/‘ directory
  • 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  • 3. That’s it!

FAQ:

Any specific requirements for this plugin to work?
Easy Digital Downloads plugin should be installed and activated, for this plugin to work.

Is that it?
Pretty much, yeah

Screenshots:

edd-extra-notes-on-checkout screenshot 1Extra note(s) textarea on checkout screen

edd-extra-notes-on-checkout screenshot 2{extra_note} email tag