Home › Forums › Front-end Issues › Front End Form
Hello everyone, i have a new one here.
I’ve have already on my page a custom post type called, ‘Musicians’ and on ACF custom fields, location is post type = musician. All good.
All musicians have been posted by admin, but i’ve created a new role called ‘artist’ and every musician with this user role is now able to edit his own page. I have assigned the existing musician to the user, so now the artist is the post author of the page. In fact, everything works good, i’ve created some new fields and a new custom post. Everything is done on front end with acf form and works.
The new scenario now is, a user logs in and is redirected to a user page with a couple of forms that once filled are displayed on his own the page.
There are already a gallery and a text field on the page that come from the ‘musician’ post type:
How can i display these existing fields and be able to edit them based on post author on the the user page i creatated? If i include the rules of user role or current user role on ‘musician’ they don’t show up. And if i put the fields with <?php echo do_shortcode(‘[my_acf_user_form field_group=””]’); ?> it’s all empty.
I think the question its just, how can a not admin user edit a custom post type field on a front end form, but only for the post or page that the user is the author?
Thank you
Jeffe
All right!!! Got it, I’m using acf_form array(),
in post_id => get_the_ID(). In case someone needs something like this:
acf_form(array(
'post_id' => get_the_ID(),
'field_groups' => array(xxx,xxx), // Used ID of the field groups here.
'post_title' => false, // This will show the title filed
'post_content' => false, // This will show the content field
'author' => $current_user->ID,
'form' => true,
'submit_value' => 'Update the post!'
));
Thank you!!
The topic ‘Front End Form’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.