You could use the core of XenForo to accomplish this. Use the node system as if the nodes are courses, and make the nodes private. Then you can add or enrol people to these nodes by editing who can access the nodes. If you need help setting something like this up, let me know. As far as I'm aware, there isn't an e learning add on that I can think of.
I know Moodle very well (I use it with a lot of schools) and it has a lot of activities built into it - forums, quizzes, questionnaires, assignments, databases, wikis, glossaries, lesson activities, SCORM capability to name but a few. Not only can you specify who can access a course but you can then split them into groups and depending on the group setup you can have, in the same course, only people from each group interacting with others in the same group. Then of course much of the e-learning work that participants do can be submitted for marking then marked online with grades available to the user and the teacher. Moodle does plenty more besides this to support e-learning too.
If you're looking at replicating what Moodle does in Xenforo then I don't think it is possible. You may be able to replicate some things (but you'll need to be much more specific about what you require) but it's likely that for extensive e-learning capability that you'd be better sticking with Moodle.