Hi, You can create your new user level. Instead of changing the user level name of subscriber. If you want to do this
1) Go to User levels from your admin account. Click edit in front of subscriber user level. Here you can change the name of this user level and file name. If you change for example subscriber.php to teacher.php and change subscriber to teacher. Make sure you change subscriber.php in your script to your new file name. Also in top of file inside authenticate function place the level name. Admins and that level users can access that page. If you place all in authenticate function then all type of users can access that file. But only loged in. Please check documentation for more details. Please make sure you change the default registration level by going to General Settings from your admin account as well.
2) Edit your register.php and find the following line in form.
<!--Default register user is subscriber, you can change it to any other level you have created-->
<input type="hidden" name="user_type" value="<?php echo get_option('register_user_level'); ?>" />
Remove this line as you are going to give user option to select the user type. Create a select option of dropdown.
Suppose you have 3 levels their names are as >> levelone, leveltwo, levelthree replace above line to following Select field. Change names to your ones. Also note that your levels names are case sensitive. If Levelname then it should be Levelname not levelname.
<select class="form-control" name="user_type">
<option value="levelone">Level One</option>
<option value="leveltwo">Level Two</option>
<option value="levelthree">Level Three</option>
</select>
Now security is very importanat anyone can change level name to admin and get access they need.
Find following lines in register.php's top.
$newObj=new Users;
$message = $newObj->register_user($first_name, $last_name, $user_type, $username, $email, $password);
HEADER('LOCATION: register.php?message='.$message);
Replace them with this.
$newObj=new Users;
if($user_type == "admin") {
$message = "You cannot add admin user!";
} else {
$message = $newObj->register_user($first_name, $last_name, $user_type, $username, $email, $password);
}
HEADER('LOCATION: register.php?message='.$message);
Thank you!