Home › Forums › General Issues › Recoding a User Field to a new one › Reply To: Recoding a User Field to a new one
If you want another field, yes this is possible.
Basically you would create the new field. Then you would create an acf/save_post filter that will get the value from your new field and update the correct value for the other plugin. The exact details of doing this are highly dependent on the other plugin https://www.advancedcustomfields.com/resources/acf-save_post/
You could use a select field for this, or a radio field.
A basic example
add_filter('acf/save_post', 'my_acf_update_user_field', 20, 1);
function my_acf_update_user_field($post_id) {
if (substr($post_id, 0, 5) != 'user_') {
// not a user being updated
return;
}
// get user ID from $post_id
$user_id = intval(substr($post_id, 5));
// get value of your field
$value = get_field('your-field-name', $post_id);
// do whatever needs to be done to update the field for other plugin
}
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.