I've created a front-end form with acf_form()
( advanced custom field front-end form ) in woocommerce "view order" page which allows customers to upload some files for us , the form works fine for administrators but when you log-in with a customer account and you choose your file it says "you don't have permission to attach files" , after some researches i edited "customer"
by adding below code to functions.php
:
/**
* Allow customers to upload files
*
* @package Wordpress
* @subpackage Rightec Theme
* @author Dornaweb.com
*/
if ( current_user_can('customer') ) {
add_action('init', 'allow_customer_uploads', 20);
add_action('admin_init', 'allow_customer_uploads', 20);
}
function allow_customer_uploads() {
$customer = get_role('customer');
$customer->add_cap('upload_files');
$customer->add_cap('unfiltered_upload');
}
i as well tried "user role editor"
plugin , but it doesn't work too
help me please!
I also had this problem trying to allow a new WooCommerce customer to upload files against an order. In addition to the permissions above, you need to:
'uploader' => 'basic'
in your acf_form() array.'edit_pages'
and'edit_posts'
to the customer role.You need ACF Pro to support the basic uploader, which you need because the WP Media uploader will never allow uploads from the frontend unless you're an administrator.
Hope this helps someone!