LMSouq
moodle-core AI Answered

Does Moodle cache User Profile Field for activity restriction?

MA
MartinG
1 month ago
3 views
Problem Description
I am trying to restrict access to Moodle course activities based on a user profile field. The profile field tracks eligibility based on other criteria such as whether they have filled in certain important information about their business. The field is required, locked and set to a default value, although setting it to unlocked made no difference. It is hidden from view in the user profile and signup screen using CSS (because Moodle user profile fields that aren't displayed in the sign up screen don't get a mdl_user_info_data row created when the user is created - but that's another issue). The relevant row in mdl_user_info_data is updated when the user submits a form that I've created. This part works absolutely fine, except that the user still needs to log out and back in again in order for the change to trickle down to the course page (i.e. for them to be able to access the course activities). It appears that the user profile fields are being cached when the user logs in, and are not being updated. Does anyone know if this is so? And the obvious follow up questions would be - Can I force this cache to be updated and, if I can, how would I go about triggering this? I'm using Moodle 2.7.3.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base