I need to run the function wp_handle_upload()
on file sent by form contain file field, and then use returned value of this function to update the meta user after registered.
In addition to several other attempts my last were:
add_action("gform_after_submission_5", "v5_armazena_avatar");
function v5_armazena_avatar() {
global $avatar;
$avatar = wp_handle_upload( $_FILES['input_5'], array( 'test_form' => false ) );
}
add_action("gform_user_registered", "v5_atualiza_avatar", 10 );
function v5_atualiza_avatar($user_id) {
global $avatar;
update_user_meta( $user_id, 'simple_local_avatar', array( 'full' => $avatar['url'] ) );
}
Currently the custom meta user is stored with value: a:1:{s:4:"full";s:0:"";}
The problem is that I do not know at wich hook I have access to the global PHP $ _FILES
.
I also tried gform_pre_submission
hook.
Any thoughts will be appreciated.
Thanks.