• Resolved neosan

    (@nreljed)


    hi,
    I’m building a form for not logged and connected users.

    -1- so I realize that I am
    unable to upload images
    (acf gallery)
    with a user other than the administrator.

    -2- when uploading with other user roles.
    the form displays wp media uploader and not the default Windows files uploader.

    can you check what’s wrong with the code plugin?

    • This topic was modified 5 years, 1 month ago by neosan.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    Hello! Thank you so much for using our plugin!

    Are you using Autoptimize or any other performance plugin on your site?

    Please send me the url to your site and I will take a look.

    Thread Starter neosan

    (@nreljed)

    Hello,
    my website still in localhost.

    Fresh WordPress install with just
    -acf fields pro,
    -elementor pro
    -and your plugin

    For the first problem it’s solved it was a question of privileges.

    the real problem is acf gallery field!
    (I’m using the elementor gallery widget associated to acf gallery)

    using the forms in admin mode = everything is Okey. Perfect ??

    But for frontend
    no way to use a basic uploader!

    Users (except admins) are not supposed to open/access to wp media. Plus it’s not friendly interface for them.

    According to this discussion

    https://support.advancedcustomfields.com/forums/topic/enable-basic-uploader-for-frontend-comments/

    it is not possible .. But it dates from 2016 and we are in 2019… Maybe a solution exists (snippet code or a php tweak code?)

    Plugin Author Shabti Kaplan

    (@shabti)

    Okay we will make this an option in the upcoming version of this plugin. You will be able to choose to use the basic uploader. Thank you for using our plugin!

    Plugin Author Shabti Kaplan

    (@shabti)

    Hello! Unfortunately, we cannot at this time let you choose to display the gallery field with a basic input. However, I can provide you some code that will limit the media library access to media that was uploaded by the current user.

    It’s may not be a friendly interface but at least they don’t have to load their pictures more than once.

    This code makes sure that non-admins can only see their own images

    // Limit media library access

    add_filter( ‘ajax_query_attachments_args’, function( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id && !current_user_can(‘activate_plugins’) && !current_user_can(‘edit_others_posts
    ‘ ) ) {
    $query[‘author’] = $user_id;
    }
    return $query;
    }
    );

    Plugin Author Shabti Kaplan

    (@shabti)

    I updated the plugin and you should now have the option to choose basic input or wp media library for file fields, but not for the gallery field. Perhaps message ACF support for a solution.
    I hope the code I shared with you can help in some way. I’m going to mark this as resolved. Have a good day!

    @shabti So is it not possible for normal users to use the Media Library for the gallery field? I’ve just come across the issue where only an admin can open the Media Library when clicking on “Add to Gallery”. Nothing happens for ordinary users.

    @shabti It’s all good, figured out the issue. From what I can tell, the Subscriber role was granted the “Upload Files” capability, but I don’t actually use that role. I have created other roles for my users, and I had to grant the same capability to those.

    As soon as I did, it worked fine ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘unable to upload images with users’ is closed to new replies.