-
Bug
-
Resolution: Fixed
-
Minor
-
2.5.3
-
None
-
MOODLE_25_STABLE
-
MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MDL-45469-master -
-
FULL STEPS
- Ensure conditional access is turned on at site level.
- Create a NEW User profile fields:
- Text area - Short name: yearofenrolment - Name: Year of Enrolment
- Create a new Student account "ABC" with the yearofenrolment field 2014
- Create a new activity on a course. Under Restrict access, add an additional user field conditions:
- User field: Year of Enrolment contain 2014
- While access is prevented: Hide activity entirely...
- Save and display settings.
- Log in as Student ABC
- Open the activity settings again
WHAT YOU EXPECTED
Student ABC should be able to see the allowed activity as his user profile yearofenrolment is 2014.
WHAT ACTUALLY HAPPENS - Moodle 2.6+
In lib\conditionlib.php the get_cached_user_profile_field function is not able to get the value from yearofenrolment from the $USER global variable.
Under this code:
if (!isset($USER->profile)) { |
...
|
}
|
else if (array_key_exists($field, $USER->profile)){ |
...
|
}
|
It fails at array_key_exists($field, $USER->profile)!!! weird!!!
Seems like a problem with $USER. But not sure about whether 2.7 is affected due to the overhaul yet.
- caused a regression
-
MDL-47667 test_get_custom_fields makes false assumpiton that no plugin will create a custom user profile field on install
-
- Closed
-