You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
When creating an ACF and setting the rules as: Show this field group if: User role is equal to ROLE
The ACF field isn't queryable through the viewer (when authenticated). Here is an example query :
Thanks for reporting this. This ACF "location rule" is not yet supported.
For context, should anyone come across this:
The GraphQL Schema is independent of any context, such as the user's role, for example. The Schema is representation of what's possible (what can be asked for), and Resolvers take into consideration context (such as the current user, or a specific object being resolved) when resolving the info. . .but in ACF, there is context, because you're loading a specific admin page to interact with the fields.
Mapping contextual rules from ACF Field Groups, such as a specific page or a specific user role, gets tricky, because the GraphQL Schema is the same Schema regardless of resolve context
so adding support for those contextual locations has been tricky to say the least.
This is a location I think we should support.
The way I see it working would be that the fields should be added to the User Type.
This way, the fields can be asked for anytime a user is asked for. During resolution, the user role can be checked, and if the user has the assigned capability, the fields will resolve. If the user doesn't have the assigned capability, the field group will return null.
Hi @jasonbahl,
I have the same problem. The fields I create should be displayed for every user, regardless of their role. Unfortunately, you can't see the "author's site" field group in GrapQL Schema. I am asking for help and information on what I am doing wrong.
WPGraphQL version 1.3.5
WPGraphQL for Advanced Custom Fields version 0.4.1
When creating an ACF and setting the rules as:
Show this field group if:
User role is equal to ROLE
The ACF field isn't queryable through the viewer (when authenticated). Here is an example query :
This returns this error :
It works when the rule is set as User role is equal to All, but will show on every user profile, which is not ideal.
The text was updated successfully, but these errors were encountered: