Home Forums Front-end Issues Front-end image upload for guest


Front-end image upload for guest

  • Hi,
    i’ve just created a front end form to update fields and upload an image for a specific custom post type.
    The front end form is in protected password page, without wordpress authentication, then the wordpress user role is null.
    The form works fine, but the image is not uploaded.
    How to I resolve this problem?

    I think that for upload an image is required a wordpress role with a “upload_image” capability

  • What version of ACF are you using? Is this for an image field of a wysiwyg field?

  • I’m using ACF 5 and it is a single image upload field

  • I’ve tested this on my installation of ACF 5 and I’m not having any issues uploading images, even on a password protected page when logged out.

    Can you try disabling other plugins? Maybe something is causing a compatibility problem or a blocking the upload?

  • I’ve tried to disabling all other plugins, but the error is the same.
    The uploader field works only if I’m login to WordPress. If I am a guest user, without wordpress login, the form only display the file name (see attachment to this comment) in an div with acf-error-message class.

    Can you post your working code?

    This is my code:

    							'post_id'		=> $_SESSION['id'],
    							'post_type'		=> 'couple',
    							'post_title'	=> false,
    							'fields'		=> array('couple_cover'),
    							'submit_value'		=> 'Aggiorna informazioni',
    							'form_attributes'	=> array('class'=>'form-horizontal', "role" => "form"),
    							'return'			=> $url.'/area-riservata/dashboard/',
    							'uploader' 			=> 'basic'
    <?php acf_enqueue_uploader(); ?>
    <script type="text/javascript">
    (function($) {
    	// setup fields
    	acf.do_action('append', $('#popup-id'));
  • I simply have an ACF field group attached to a password protected page. This field group has only one field, an image field. I show the the field group using

    if (!post_password_required()) {

    This shows the form only if the user has entered the password.

    I was only testing to see if it works, and it does allow the uploading of an image.

    The operation you are seeing, only the file name and select is the correct operation for users that are not logged into the site. I have looked but I cannot find any information on displaying anything different or allowing access to anything different for visitors that are not logged into the site. From the information I have found, this is a recently added feature and there are no plans to extend or increase the functionality for users that are not logged into the site.

  • function acf_enqueue_uploader() {
    	if( current_user_can('upload_files') ) {

    The above is the key in advanced-custom-fields-pro/core/input.php

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

The topic ‘Front-end image upload for guest’ is closed to new replies.