Ok, I found 2 sites which may be to some help.
This one and this one.
A snippet from the first link:
The best way to understand what a hook does is to look at where it occurs in the source code.
Action hooks look like this: do_action( "hook_name" )
Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).
Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
if ( isset($role) ) {
$user = new WP_User($user_id);
$user->set_role($role);
} elseif ( !$update ) {
$user = new WP_User($user_id);
$user->set_role(get_option('default_role'));
}
wp_cache_delete($user_id, 'users');
wp_cache_delete($user_login, 'userlogins');
if ( $update )
do_action('profile_update', $user_id, $old_user_data);
else
do_action('user_register', $user_id);
return $user_id;
}
But how exactly can I take advantage of this?
I'm guessing that in my plugin, I have to make some code that gets selected user role, and assign this to the user. But how to accomplish this, I'm not sure.
Any suggestions?