Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report Builder - no-signup custom user fields are not shown #1979

Open
kirck1984 opened this issue Apr 29, 2024 · 0 comments
Open

Report Builder - no-signup custom user fields are not shown #1979

kirck1984 opened this issue Apr 29, 2024 · 0 comments

Comments

@kirck1984
Copy link

Hello,

$version = 2022112805.00;
$release = '4.1.5 (Build: 20230814)';
$branch = '401';
$maturity = MATURITY_STABLE;

AND

$version = 2023100904.00;
$release = '4.3.4 (Build: 20240422)';
$branch = '403';
$maturity = MATURITY_STABLE;

in the report builder, non-signup custom fields are not shown.

//ADMIN
Login in as admin

//CREATE COURSE
Navigate to Courses > Add a new course
Create a course
Assign an user with role Teacher to the course

//CREATE CUSTOM USER PROFILE FIELDS
Navigate to Users > Accounts > User profile fields
Create a new profile field, a Drop-down menu for example
Set the "Display on signup page?" to No
Create another profile field, another Drop-down menu
Set the "Display on signup page?" to Yes

//CREATE REPORT
Navigate to Reports > Report builder > Custom reports settings in site administration
Set "Course participants" as name of course
Select "Course participants" as report source
Do no check the field "Include default setup"
Do no check the field "Remove any duplicate rows"
Add the two custom user fields as columns of the report

Navigate to Audience > Manually added users
Add the user with role Teacher

//TEACHER
Login as teacher
In homepage, from the user menu, choose the item "Reports"
Open the report "Course participants"
No signup fields will not be visible

I believe the problem lies with the file "/user/profile/lib.php", function is_visible.

Also I notice that the two globals vars $USER, $COURSE are populated with the same object.
This causes the capability check to return false:
$coursecontext = context_course::instance($COURSE->id);
return has_capability('moodle/site:viewuseridentity', $coursecontext);

Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant