Support

Account

Forum Replies Created

  • Hi @roger,

    I encountered exactly the same issue, and i’ve written a logic which does the following:

    -gets the current logged in user id
    -in a loop, get the id’s of all posts by that user
    -checks whether this specific post id is created / allowed to be edited by that user
    -if allowed, nothing happens, and edit form is loaded /
    -if not allowed, exit() and redirect the user

    here’s my code, please place it in the page in which your frontend form resides, after your “get_header()” or “wp_head()” (can’t run the loop before that):

    $user_ID = get_current_user_id();
    
    $args = array(
    	'post_type' => 'your_post_type',
    	'posts_per_page' => -1,
    	'post_status' => 'any',
    	'author' => $user_ID
    );
    
    // The Query
    $the_query = new WP_Query($args);
    
    // The Loop
    if ( $the_query->have_posts() ) {
    	$posts_by_user = array();
    	while ( $the_query->have_posts() ) {
    		$the_query->the_post();
    		$posts_by_user[] = get_the_ID();
    	}
    } else {
    	//echo 'no posts found';
    }
    
    /* Restore original Post Data */
    wp_reset_postdata(); 
    
    // Check and redirect if needed
    if (in_array($book_ID, $posts_by_user)) {
    	//echo "Post ID found in array";
    } else {
    	$location = get_home_url();
    	$status = '302';
    	wp_redirect( $location, $status );
    	exit;
    }

    The code is checked and working, let me know if i can help in any other way.

  • 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

  • Hi,

    I’m joining @jaace request, “is there a way to make the file upload a drag-and-drop without triggering that modal popup so that it’s just on the page as a drag-and-drop uploader?”

    Currently trying to integrate http://www.dropzonejs.com/ library with ACF. Has anyone had any experience with integrating dropzone or any other drag and drop js libraries with ACF?

    Thanks and p.s thank you @elliot for this amazing plugin, really took my development to the next level. purchased all add-ons and will continue to do so 🙂

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

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.