Support

Account

Home Forums ACF PRO ACF Front form to create posts

Helping

ACF Front form to create posts

  • Hello,

    I would like to use acf_form for a photo contest, with a front end form to submit photos.

    “Photo” will be a custom post type with 2 taxonomies, but for my tests I use regular posts.
    The form will only be available for registered users (subscriber role)

    I created these custom fields :
    – taxonomy 1
    – taxonomy 2
    – Photo upload 1
    – Photo upload 2

    I managed to do almost everything I needed 🙂
    BUT
    There’s a problem with the image upload… it seems only Editor role can upload. So I added a custom subscriber Role to WP to autorize upload, but then the subcribers can see all the medias ! Is there a way to prevent that ? I’d like them to only have access to their own uploaded photos.
    Regarding security, can I only allow .jpg files for example ?

    Also, I didn’t find a way to use the post thumbnail field, it can be useful.

    here’s my code (I use ACF 5 Pro) :

    <?php while ( have_posts() ) : the_post(); ?>
    
    	<?php acf_form(array(
    		'post_id'		=> 'new_post',
    		'new_post'		=> array(
    		   'post_type'    => 'post',
    		   'post_status'  => 'draft'
    		),
    		'post_title'	=> true,
    		'submit_value'	=> 'Submit your photo'
    	)); ?>
    	
    <?php endwhile; ?>

    thanks if you can help !

    thomas

  • Hi @anybodesign

    The image field contains a setting for library which determines the media available to be selected. If you set this field setting to ‘Uploaded to post’, the media library should be blank for the new post!

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

You must be logged in to reply to this topic.