Permalink
Browse files

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

…can not have both
  • Loading branch information...
skodak committed Feb 12, 2011
1 parent cc10c0b commit 4f97de76241ba0dccc82a63b159e12576b6b7555
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/moodlelib.php
View
@@ -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)) {

0 comments on commit 4f97de7

Please sign in to comment.