Support

Account

Home Forums ACF PRO Populate ACF Field on user-new.php

Solved

Populate ACF Field on user-new.php

  • I’ve been looking and finding no answers, I’m trying to auto-populate an ACF field on user registration.

    Basically, I want an ACF field to populate with a random string everytime a user registers.

    The user doesn’t have an id so i can’t use the acf set value function and now im not sure I can do set that up

  • Found my solution (below)

    function custom_user_profile_fields($user){
    ?>
    <script>
    (function($) {$(function() {
    	document.getElementById("send_user_notification").checked = false;
    	//JS HERE
    });})( jQuery );
    </script>
    <?php
    }
    //add_action( 'show_user_profile', 'custom_user_profile_fields' );
    //add_action( 'edit_user_profile', 'custom_user_profile_fields' );
    add_action( "user_new_form", "custom_user_profile_fields" );
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.