-
Notifications
You must be signed in to change notification settings - Fork 125
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
ACF not showing when rule is set to user role #58
Comments
Hey @jydmnd! 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 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 |
👋🏻 Sorry for the delay on this, but this has been fixed! With v0.5.0 (#250) you can use the Below is a screenshot of this rule in action, and the new UI where you can opt-in to manually overriding how it is auto-mapped if needed. |
Hi @jasonbahl, WPGraphQL version 1.3.5 |
I updated the plugin to version 0.5.2 and the problem is fixed |
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: