• Resolved robindarlington

    (@robindarlington)


    Hi, first up I love this plugin.

    Since the the latest update I have an error in my front-end forms with file and gallery fields.

    Uploads fail with message “Sorry, you are not allowed to attach files to this post.” where before they were working without any issue.

    These errors appeared after updating both WordPress to version 6.0.2, ACF to version 6.0.1 and ACFE to version 0.8.8.9 so I am not entirely sure what caused it.

    Other oddities include the fact that:

    – When I choose the “default” uploader option for my field, I still get the WordPress uploader, except without “uploaded to current post” limitation (I can see all files in media library).

    – Even using the “default uploader” I get the same error.

    – My permissions have not been changed at all (I use Members plugin with a custom user role, and it was all working perfectly until these last updates).

    I checked and there are no JavaScript errors in the console, and also no errors in debug.log when I turn on debugging.

    Any suggestions would be greatly appreciated as for now this has broken my site.

    Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter robindarlington

    (@robindarlington)

    After a bit more investigation:

    – this issue appears from ACFE version 0.8.8.8.
    in version 0.8.8.7 it still works as expected. I have downgraded to that version for now.

    – it also seems to appear the same in previous versions of ACF and WordPress (tested WP v 6.0.1 and ACF all the way down to 5.12.3).

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback and the detailed report.

    In fact, I added a fix in a recent patch to attempt to fix the “Uploaded to” filter in the WP Media modal on the front-end. It’s a kinda complex topic because ACF & the WP Media Modal weren’t designed to handle multiple posts submission/creation within one single form, which is possible with ACFE Form.

    I’ll come back to you later for more details, and revert that fix in the upcoming patch.

    In order to fix the issue while waiting for the next release, you can add the following code in your functions.php file. It will revert back to the 0.8.8.7 working logic:

    add_action('acf/input/admin_print_footer_scripts', 'acfe_form_fix_upload_permission');
    function acfe_form_fix_upload_permission(){
        ?>
        <script>
        (function($){
    
            if(typeof acf === 'undefined' || typeof acfe === 'undefined'){
                return;
            }
    
            acf.addAction('prepare', function(){
                
                if(!acfe.get('is_admin') && acf.isset(window, 'wp', 'media', 'view', 'settings', 'post')){
                    wp.media.view.settings.post = false;
                }
                
            });
    
        })(jQuery);
        </script>
        <?php
    }
    

    Sorry for the inconvenience.

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Just a heads up to let you know that the latest 0.8.8.10 patch reverted the logic back to 0.8.8.7. You can safely update your plugin and remove the quick fix code I provided.

    Have a nice day!

    Regards.

    Thread Starter robindarlington

    (@robindarlington)

    Great, I will update to 0.8.8.10 in that case.
    And thank you so much for the quick and detailed responses. I really appreciate it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error with front-end form file uploads’ is closed to new replies.