Time for action – specifying a group enrollment key
Return to your course front page and click on Groups, under Course Administration then Users in the Settings block.
Select the group you want to edit and press the Edit group settings button.
Specify a group enrollment key. This can be anything you like. To reveal the key you have just typed (so you can read it) ensure the Unmask setting is ticked. It's useful in a school situation to have this as the name of the class for any course, for example, 9A, 9B, and so on.
Press the Save changes button and you're done.
What just happened?
We've just specified an enrollment key for the group. This means that I can give a student the group enrollment key and when they come to enroll they use the group key (rather than the course key) to get on the course. This not only registers them on the course but also automatically adds them to the right group.
Different groups can have different keys, and if I don't want particular students added to any group...