set Roles by register fields

Hi all.

I want to set roles by a register fields. 


If I have a mandatory fields in the registration form with sex male / female, when the new user selects female then assigns roles_wife, however, if the user selects male assigns roles_husband.

Do you have any idea on how I could do this?

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking