Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-23939 do not load groups and profile for guest user because they …

…can not have both
  • Loading branch information...
commit 4f97de76241ba0dccc82a63b159e12576b6b7555 1 parent cc10c0b
@skodak skodak authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/moodlelib.php
View
19 lib/moodlelib.php
@@ -3802,18 +3802,23 @@ function get_complete_user_data($field, $value, $mnethostid = null) {
// this is a special hack to speedup calendar display
$user->groupmember = array();
- if ($groups = $DB->get_records_sql($sql, array($user->id))) {
- foreach ($groups as $group) {
- if (!array_key_exists($group->courseid, $user->groupmember)) {
- $user->groupmember[$group->courseid] = array();
+ if (!isguestuser($user)) {
+ if ($groups = $DB->get_records_sql($sql, array($user->id))) {
+ foreach ($groups as $group) {
+ if (!array_key_exists($group->courseid, $user->groupmember)) {
+ $user->groupmember[$group->courseid] = array();
+ }
+ $user->groupmember[$group->courseid][$group->id] = $group->id;
}
- $user->groupmember[$group->courseid][$group->id] = $group->id;
}
}
/// Add the custom profile fields to the user record
- require_once($CFG->dirroot.'/user/profile/lib.php');
- profile_load_custom_fields($user);
+ $user->profile = array();
+ if (!isguestuser($user)) {
+ require_once($CFG->dirroot.'/user/profile/lib.php');
+ profile_load_custom_fields($user);
+ }
/// Rewrite some variables if necessary
if (!empty($user->description)) {
Please sign in to comment.
Something went wrong with that request. Please try again.