MDL-12351 verify active group before use because allowed groups may change; merged from MOODLE_19_STABLE
MDL-12351 verify active group before use because allowed groups may change; merged from MOODLE_19_STABLE

dilawar/moodle