Ok where do you put the code and how can we make it for role.
Why don’t you use the built in wordpress ids? If you view all users and hover over a user it will show the user ids. https://codex.wordpress.org/Function_Reference/get_userdata
members or s2members plugin should work along with xprofiles acl plugin to assign profile fields