fixed sql to prevent link duplication and non multiprovider registration of same username
bug fix in get_course_max_level method
Merge branch 'master'