Home › Forums › Front-end Issues › Front End and custom user meta › Reply To: Front End and custom user meta
@RichB, @karlkinkin, maybe you guys should read that great article posted by @elliot : http://www.advancedcustomfields.com/resources/tutorials/using-acf_form-to-create-a-new-post/ and this one also of not done yet : http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/
Here is a quick overview of what I understand from these articles, hope it helps :
According to the atticle called “Using acf_form to create a new post”, by hooking to acf/pre_save_post, the function you assign (my_pre_save_post) receives an ID. This ID comes from the post_id passed to acf_form function. If you pass it “new” instead of a post ID, you can do whatever you want, such as creating a post, plus, your custom fields will be saved automatically if you return a post ID after your custom code is executed. You can also see that the function my_pre_save_post returns the post ID and does nothing else if the ID is different than “new”. This is because the function acf_form does the updating job automatically, so there is no need to hook to acf/pre_save_post here.
Also, by adding the prefix “user_” to your ID, acf_form saves user metas instead of post metas. Ain’t that great !
That said, @RichB, you might need to split your user management and post creation/updating in two separate pages. I don’t know exactly what your use case is but it looks you are calling acf_form with wrong parameters.
Cheers !
Dominic
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.