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

dev/core#1984 fix custom fields sometimes missing from profiles #25321

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

spalmstr
Copy link
Contributor

Overview

We were finding that custom fields were missing from profiles from time to time. See Sometimes Custom fields missing on profile

Before

Profiles would be missing their custom fields even if the user had access to them.

After

Profiles are now available to users, even if a less privileged user was the first one to access the profile after a cache refresh.

Technical Details

The list of custom fields for a profile is held in a cache created when the profile is first accessed after the cache has expired. Before this change that cache was generic to all users,, so it only held the fields visible to the first user accessing the profile after the cache refresh. If that user did not have access to the fields, they were not in the cache and subsequent users couldn't see them. By adding the user ID to the cache key, it means that each user creates their own cache, so they can see the fields to which they have access.

Comments

Anything else you would like the reviewer to note
It is a very simple change, simply adding the user id to the cache key used to hold the custom field information.

@civibot
Copy link

civibot bot commented Jan 11, 2023

(Standard links)

@civibot civibot bot added the master label Jan 11, 2023
@eileenmcnaughton eileenmcnaughton changed the title Issue 1984 dev/core#1984 fix custom fields sometimes missing from profiles Jan 12, 2023
@eileenmcnaughton
Copy link
Contributor

@spalmstr there are a couple of style issues - https://test.civicrm.org/job/CiviCRM-Core-PR/53071/checkstyle/

Non blocking but I think $contactID rather than $id is a clearer variable name for the contact id of the logged in user

@eileenmcnaughton
Copy link
Contributor

Thanks @spalmstr

@eileenmcnaughton eileenmcnaughton merged commit 4ffd4cd into civicrm:master Jan 12, 2023
@spalmstr spalmstr deleted the Issue_1984 branch January 2, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants