Support

Account

Home Forums Front-end Issues frontend gallery field

Solved

frontend gallery field

  • Hi,
    I’ve created a form that contains upload and gallery fields.
    Upload field works fine, instead the gallery field generates a query error when I click on “Add to gallery” button.
    If I logged in, the gallery field works and media popup appears.
    This is the jQuery error that I see in js console

    [Error] TypeError: undefined is not an object (evaluating ‘wp.media.query’)
    popup (acf-input.min.js, line 1)
    add_attachment (acf-pro-input.min.js, line 1)
    (funzione anonima) (acf-input.min.js, line 1)
    dispatch (jquery.min.js, line 3)
    handle (jquery.min.js, line 3)

    I would that gallery field works in frontend form, without the user is logged in.
    Can you help me?

  • some ideas from anyone?

  • It does not appear that the gallery field works when not logged in. I’ve tried everything I can think of here.

    Your bet for doing this if you want to allow the user to create a gallery on the front end without being logged in would be to give them a repeater field with image fields for uploading multiple images and then to create an acf/save_post action to take the images from the repeater and add them to the gallery field.

    http://www.advancedcustomfields.com/resources/acfsave_post/

    http://www.advancedcustomfields.com/resources/update_field/

  • I’ve tried this with a logged in user as well and still getting the JS error. The only time I do not get the error is when I am viewing the front end form while logged in as an admin.

  • The problem is that in order to use the gallery field the user has to have access to the media library. Any user type that does not have access to editing the media library will cause a JS error.

    I think this means that the user must be at least a contributor, maybe an author.

  • Enqueuing wp_enqueue_media() will fixed the [Error] TypeError: undefined is not an object (evaluating ‘wp.media.query’) error.

    But you may still need to a plugin like ‘User role editor’, ‘User Access Manager’ to enable user access to the media library.

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

You must be logged in to reply to this topic.