Pre-fill field with username
-
Hiya,
I’m using Advanced Forms and ACF Pro to build a registration tool for my colleagues. It would be a real time-saver if I could pre-fill a certain field with the name of the current user in Advanced Forms.
Is this in some way possible?
I’ve been able to get it working in the dashboard (using a ‘user’-field which loads the current user, code below) but this breaks the Advanced Form in the front-end.
function my_prepare_field( $field ) { $user = wp_get_current_user(); $user = $user -> ID; $field ['value']= $user; //set user to current user return $field; } add_filter('acf/prepare_field/name=user', 'my_prepare_field');
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Pre-fill field with username’ is closed to new replies.