Assigning input to variable

Your form doesn’t contain the fields you think it does. Use FireBug or a similar tool (even var_dump($_POST)) to see what is actually being posted. Your num_users is a setting group, not a single field. At best the field with the value will be user_main_settings field. The previous commenter is also correct – checking for … Read more

Set user role, if an specific role created an user

You can use user_register action, which is invoked after registering a new user. To add or remove roles/caps, the WP_User class provides methods: add_cap(), add_role() remove_cap(), remove_role() Your code might look like this: add_action( ‘user_register’, ‘se385135_user_register’ ); function se385135_user_register( $user_id ) { $user = wp_get_current_user(); if ( !isset( $user->ID ) || $user->ID == 0 ) … Read more