Support

Account

Home Forums Front-end Issues Repeater & Image Upload Failing

Solved

Repeater & Image Upload Failing

  • I am currently working on a front end repeating image uploader for user profiles. The majority of this works fine and correctly saves the information. However, REGARDLESS of what capabilities I give to the user, the upload will fail on any user level below an editor.

    I realize that this might not be an ACF question specifically but am hoping that it is. Any help would be appreciated!

  • Hi @chriscarvache

    Have you tried absolutely every capability?
    Perhaps you have an error in the returned AJAX data when uploading? Have you checked your console log for this?

    Perhaps you have a filter / action which is stopping the uploading uploader / wp admin depending on the user?

  • I’ve tried every capability, checked the console log and there are no errors and nothing that stands out of the ordinary. The only thing I can think of is that there is SOME conflict with the ‘Theme My Login’ plugin. ACF doesn’t natively integrate with the plugin and I have to use the ACF front end form function to correctly display the form and some action hooks to save the data. This will work when the user role is admin or editor but none other.

  • On further investigation, this issue does NOT have to do with the Theme My Login plugin.

    My code for the template is below. Could there be something wrong with it?

    <?php
    /**
     * Template Name: Profile Downloads
     * ==============================================
     * This template is responsible for managing the
     * each user's downloads.  Let's see how this goes
     *
     * @author		carvache
     * @date		8/30/2014
     */
    
    // Preprocessing Logic
    if ( !is_user_logged_in() )
    	exit('You must login to see this page');
    
    acf_form_head();
    
    get_header();
    	?>
    	<div class="content-wrapper">
    		<div class="page-wrapper">
    			<div class="gdl-page-float-left">
    				<div class="gdl-page-item">
    					<div class="sixteen columns mt 30">
    						<h1 class="gdl-page-title gdl-divider gdl-title title-color"><?php the_title() ?></h1>
    						<?php
    
    						acf_form(array(
    							'post_id' => 'user_' . get_current_user_id(),
    							'field_groups' => array(600), // the ID of the field group
    							'updated_message' => '', // default updated message. Can be false to show no message
    							'form' => true
    						));
    
    						?>
    					</div>	
    				</div>
    			</div>
    		</div>
    	</div>
    	<?php
    get_footer();
  • Hi @chriscarvache

    The issue may be caused by the post_id setting.

    Perhaps there is a bug when setting this to a string – WP media popup will expect it to be an int.

    I’ll do some testing and let you know what I find,

    Thanks
    E

  • Thanks so much. Any way I can help you with this?

  • Sure.

    Test changing the post_id param to an int. Does the form now work as expected?

  • Hi @chriscarvache

    I’ve tracked down and solved the issue. Now you can upload images when editing a user via the front end form without error!

    Can you grab the latest ACF from github and test it out?

    Thanks
    E

  • Just tried the new v4.3.0 from github. This unfortunately didn’t solve this. If its all the same to you, here’s a blow by blow of what’s happening.

    • Users are Subscribers
    • Subscribers have additional capabilities: upload_files & unfiltered_upload
    • Every upload fails on the front end

    See attached screenshot. Thanks in advance for helping!

  • Hi @chriscarvache

    It is possible that your issue is a unique one. Are you able to turn on DEBUG MODE in your wp-config.php file, then jump back to the front end form and refresh your browser, open up your console log and test the upload again.

    After the image fails to upload, you should see the ajax call in the console log and you can review the returned HTML. What are the error messages?

    Thanks
    E

  • I had a similar problem with ACF 4.2.2, then i updated to 4.3.0 and it was fixed. See here:
    http://support.advancedcustomfields.com/forums/topic/authors-cant-upload-from-front-end-form/

    After a few days, and i don’t know why, i was getting the same problem again. This time i found that TML’s Themed Profiles module is causing this (which is weird because it was activated before).

    This thread solved my problem, and it might help you:

    http://wordpress.org/support/topic/solving-wp-media-upload-in-the-frontend-and-tml?replies=4#post-4851176

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

The topic ‘Repeater & Image Upload Failing’ is closed to new replies.