Skip to content

Conversation

@pkevan
Copy link
Contributor

@pkevan pkevan commented Apr 23, 2025

Shows errors when user is logged in, and has appropriate capabilities.

Fixes #85.

Testing instructions

  1. Add field to new install of SCF
  2. Use shortcode [acf] to output field via [acf field=""]
  3. Observe that with an administrator role, no output is display
  4. Apply this PR
  5. Re-test output, and a display error should be displayed in place of the field output
  6. Check while logged out that no output is display as was show when logged in as administrator

Note: considered adding this to (

if ( is_preview() ) {
), but given the additional filter, it didn't seem appropriate, although happy to be convinced otherwise.

Shows errors when user is logged in, and has appropriate capabilities.

Fixes #85.
@pkevan pkevan added the [Type] Enhancement New feature or request label Apr 23, 2025
@priethor
Copy link
Contributor

Hi Paul! Can you share brief instructions in the PR description to test the PR?

@pkevan
Copy link
Contributor Author

pkevan commented Apr 23, 2025

Hi Paul! Can you share brief instructions in the PR description to test the PR?

Most of the details are in the original issue: #85 (comment) but can adjust the PR if needed a bit later.

@priethor
Copy link
Contributor

I would suggest adding, in general, a short section with steps to test it and the expected outcome with and without the PR, similar to Gutenberg PRs. Even though the original ticket wasn't too hard to follow, it still required me to read all the comments to get the context 😅

@pkevan
Copy link
Contributor Author

pkevan commented Apr 24, 2025

I would suggest adding, in general, a short section with steps to test it and the expected outcome with and without the PR, similar to Gutenberg PRs. Even though the original ticket wasn't too hard to follow, it still required me to read all the comments to get the context 😅

Added in test instruction.

@priethor
Copy link
Contributor

For documentation purposes, note that I had to do some (obvious) extra steps:

  • Enable shortcodes programmatically.
  • The Field Group is assigned to posts

With this branch, the error message appears indeed. However, I also see it when using the shortcode to display a Text Field, which, in theory, is supported by the shortcode. Am I missing something?

@pkevan
Copy link
Contributor Author

pkevan commented Apr 28, 2025

However, I also see it when using the shortcode to display a Text Field, which, in theory, is supported by the shortcode. Am I missing something?

🤔 presumably this works as expected without the patch?

@pkevan
Copy link
Contributor Author

pkevan commented Apr 30, 2025

However, I also see it when using the shortcode to display a Text Field, which, in theory, is supported by the shortcode.

In order to not see the message, the field needs to be enabled via the Editor UI radio:

Screenshot 2025-04-30 at 15 23 44

Or were you trying another way?

@pkevan
Copy link
Contributor Author

pkevan commented May 1, 2025

I wonder how much value there would be in enabling the shortcode via a setting, rather than requiring some code to be added?

Copy link
Contributor

@priethor priethor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply, my issue was related to the Allow Access to Value in Editor UI as I was seeing a different kind of error message:

  • With this PR:
    • Disabling the checkbox shows the message [The requested ACF field is not allowed to be output in bindings or the ACF Shortcode.] message from the preview, or if the user has enough permissions (not for unlogged users).
    • Enabling the checkbox hides the message.
  • Without this PR:
    • The message doesn't show regardless of the checkbox status or the user.

@cbravobernal cbravobernal merged commit 427943c into trunk May 5, 2025
5 checks passed
@cbravobernal cbravobernal deleted the fix/issue-85 branch May 5, 2025 17:33
@priethor priethor added this to the 6.5.0 milestone May 14, 2025
@pkevan pkevan mentioned this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shortcode Bug

4 participants