Hi John,
Thanks for your quick reply.
For Second problem, regarding data is being saved under wp_options table, now i am using acf/pre_save_post filter instead of acf/save_post filter. Now it’s work properly. Now no more data is being saved in wp_options table.
For First issue, i still have some confusion, where do i write below code, i meant to say in which hook do i write code ?
// Create a new user
if ( 'create_user' === $post_id )
{
$user_name = sanitize_text_field($_POST['acf']['field_5e42850b5b270']);
$user_email = sanitize_email($_POST['acf']['field_5e4282dbd4ddd']);
$user_password = sanitize_text_field($_POST['acf']['field_5e4284f25b26f']);
$new_user_id = wp_insert_user(array(
'first_name' => $user_name,
'user_email' => $user_email,
'user_login' => $user_email,
'user_pass' => $user_password,
'role' => 'subscriber'
));
if( is_wp_error( $new_user_id ) )
{
$error_string = $new_user_id->get_error_message();
echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
}
else
return true;
Because as you mentioned that to validate field, we need to use acf/validate_value filter for all fields. Because we don’t know at what circumstances wp_insert_user() function will return error.
So my question is that when using acf/pre_save_post filter, if any error occur runtime inside wp_insert_user() function, then how can we show error message ?
Hello,
I am also facing same issue. My Frontend form is prefilled with previous entries all the time
I have created Registration Form in Backend with ACF. See attached screenshot.
Now with using acf_form() function i am showing that Registration Form in Front-end.
Issue 1 :
Any user Register itself, then my Registration Form prefilled automatically with previous entries. I know that it comes from wp_options table.
After i delete those entries from wp_options table then it is not showing previous entires. So my question is that do we have to clear all such entries each and everytime when new user create their account.
Please find attached screenshot.
In the above code, some little change
if( is_wp_error( $new_user_id ) )
{
$error_string = $new_user_id->get_error_message();
echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
}
But still error message is not being displayed in Front End Registration Form.
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.