Got it.
THANK YOU VERY MUCH!!!!!!
Since I need the username instead of the ID I’ve changed the code this way:
add_action( 'um_registration_complete', 'um_110821_user_referral', 1 );
function um_110821_user_referral($referer_name) {
$current_user = wp_get_current_user();
$user_name = $current_user->user_login;
update_user_meta( $referer_name, "um_user_referral", $user_name );
}
And I’ve seen that I can add its email field too, with its meta_key.
In the following example, I’ve used um_mail_referral as meta_key (for a text field… mail field will be used for other purposes and there is no more of them available ) and I’ve changed the name of the action. (Maybe there’s a way to do it faster and smarter but it works)
add_action( 'um_registration_complete', 'um_88046_mail_referral', 1 );
function um_88046_mail_referral($referer_mail) {
$current_user = wp_get_current_user();
$user_mail = $current_user->user_email;
update_user_meta( $referer_mail, "um_mail_referral", $user_mail );
}
BTW, is there a way to cleanup the meta_keys used in deleted field? They still appears in members directory…
I’m going to see if I can hide those text field too!
Again: Thank you!