Restrict Access - Custom User Profile Field

Restrict Access - Custom User Profile Field

by Douglas Matheson -
Number of replies: 2
Hi folks,

I am having a bit of a problem trying to get a topic to hide/show depending on a custom user profile field.  For context, my school is running an MBA program and the students can choose 3 electives.  I would like to have a profile field (drop down or text input) where I can set it so that the electives I add to their profiles are the ones they have access to.  At the moment, I have 2 fields: 'Transport Elective', and 'Health Elective'.  My input is 1 or 0 to try and avoid typos.

I have a test student and I have set both of the fields to 1. 

Inside my course I have created 2 topics: 'Elective - Transport', and 'Elective - Health'. 

Going into the settings, I have both of them set to the following:

Student MUST match the following - User Profile Field 'Transport Elective' is equal to 1 (I have left the eye open) 

My understanding is that this means that any user with the 'Transport Elective' field set to '1' will be able to see this topic, however, it is the opposite.  I cannot seem to make the topic appear and it is driving me a little mad.  I have tried multiple field types with mulitple variations of show/hide but it has defeated me. 

I have read through this: https://docs.moodle.org/403/en/Restrict_access_settings and I believe I am following it correctly.

I have added some screenshots here:

Admin View





Student View



Profile -



I am using Moodle 4.3.3 (Build: 20240212) and PHP version 8.0.30

It is also a completely new Moodle, there is no student/tutor data so I am happy to give access if it makes things easier?  I'm completely stumped so any help/pointers would be much apprecaited.

Thanks

Douglas
Average of ratings: -
In reply to Douglas Matheson

Re: Restrict Access - Custom User Profile Field

by Douglas Matheson -
SOLVED IT!

Posting it here in case anyone else ever has the same issue.

Basically, it's a caching issue. The changes weren't being updated at all until I logged out of the student account and logged back in. It was so simple that I didn't even consider it.

Thanks if anyone took a look! smile
Average of ratings: Useful (2)
In reply to Douglas Matheson

Re: Restrict Access - Custom User Profile Field

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Good to know and thanks for responding with your solution. I did take a look but found it worked correctly so I thought I would wait and see if others had something to comment instead.