Support

Account

Home Forums Front-end Issues Authors can't upload from front-end form

Solved

Authors can't upload from front-end form

  • Hi

    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.

    Kind Regards

  • Hi @burimshala

    Thanks for the info. Can you console.log the value of acf.post_id?

    What is it?

    Thanks
    E

  • Hi

    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.

  • Hi,

    i think i have a similar problem. I generated a custom user grp but i can’t figure out how to allow them to upload files.

    I commented line 718 but it still didnt work.

    Thanks for your help.

  • Hi guys

    I have done some work on this issue and have pushed some new code to the github repo.

    Can you please download the latest ACF plugin from github and test out the issue?

    Thanks
    E

  • I also have the same problem, uploaded the new code but still getting an error on upload.

  • Hi guys.

    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?

    Thanks
    E

  • 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.

    Thanks!

  • Hi @kapslok

    Can you please check your console log and look for any JS errors?

    Thanks
    E

  • Hi @kapslok

    Don’t worry about testing your console log. I just replicated the issue and have now pushed a fix to github

    Thanks
    E

  • Hi there,

    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.

    Please help.

    Thank you

    Diana

  • Hi @dianaavila

    Please have your console log open from BEFEORE the page load. This will capture all errors during the page load.

    Also, errors may occur when you click on the add image button

    Thanks
    E

  • Hi Elliot,
    The console was open before I load the page, the same for selecting an image.

    Any suggestions?

    Diana

  • Hi @dianaavila

    If you like, I can log in and take a look myself on your site?
    You can post a ‘private’ reply on this thread with details.

    Thanks
    E

  • Hi Elliot,

    Thank you very much for the offer, we decided to go with a custom made form and inserting into de bd ourselves.

    Thank you,

    Diana

  • |Im having this issue I’m on the latest version of acf

Viewing 17 posts - 1 through 17 (of 17 total)

The topic ‘Authors can't upload from front-end form’ is closed to new replies.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.