$course = get_course($params['courseid']);
$user = core_user::get_user($params['userid'], '*', MUST_EXIST);
-
- if ($user->deleted) {
- throw new moodle_exception('userdeleted');
- }
- if (isguestuser($user)) {
- // Can not view profile of guest - thre is nothing to see there.
- throw new moodle_exception('invaliduserid');
- }
+ core_user::require_active_user($user);
if ($course->id == SITEID) {
$coursecontext = context_system::instance();;