When you are logged in as an Administrator you are allowed to upload files, but if you have any other user level (Author, Editor) and even if you have “upload_fiels” capability, the wp.media won’t allow you to upload files.
This is caused by
wp.media.view.settings.post.id = acf.post_id; which is on input.js on line 718.
I think WordPress does generate a hidden post, to store the post state while being edited, and when user tries to upload a file, than it has no permission on that ID (seen on wp-admin/async-upload.php).
I commented that line, as i have a WSYIWYG Editor there, but you have to hook that up.
Well this should be the auto-generated post id, and it did not worked until the post ID was 0 (and it is not and never was 0 the acf.post_id).
I commented that line, and it worked, otherwise it won’t work.
And the worst this is that, it is on a setTimeout, which tries to assign to the object wp.media each 10 seconds.
If the issue is only for a specific user type, perhaps there is some kind of PHP error preventing the upload from working.
Can you please turn on DEBUG MODE in your wp-config.php file and then open up the console log during the upload process. Click on the ajax call to see the response data. Are there any errors in the response?
Hi, new code fixes the problem… My custom role had the depreciated user_level capability missing. $role->add_cap( ‘level_1’ ); fixed the problem.
However I noticed that with the new code, WYSIWYG fields in both front-end and back-end show as empty. The field is being saved but the WYSIWYG field is being rendered as empty.
I’m having a similar problem, I created a front end form that includes a couple of image upload CF, I’m logged in as Adminsitrator.
I’m tried WP 3.8 and 3.7.1 with ACF 4.3.2. In both cases, nothing happens when I click “Select” after selecting and image from the library nor I can upload a new image.
I’ve checked the console log, but nothing came up.
The topic ‘Authors can't upload from front-end form’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.