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

Add the ability to hook into filter #225

Closed
aamplugin opened this issue Oct 18, 2022 · 0 comments
Closed

Add the ability to hook into filter #225

aamplugin opened this issue Oct 18, 2022 · 0 comments
Assignees

Comments

@aamplugin
Copy link
Owner

aamplugin commented Oct 18, 2022

It'll be useful to hook into any registered filter and override its result. One of the useful cases that inspired this enhancement is Funnel Builder plugin that apparently manages access to its functionality based on user's role rather than on any specific capability or set of capabilities.

Fortunately it has the ability to hook into the process and adjust its behavior:

Screen Shot 2022-10-11 at 4 35 31 PM

To avoid writing code, Access Policy is a great way to inject filter override. The policy like this may do the trick:

{
    "Statement": [
        {
            "Effect": "apply",
            "Resource": "Hook:wffn_user_access_capabilities:11",
            "Response": {
                "editor": {
                    "menu": [
                        "read",
                        "write"
                    ],
                    "funnel": [
                        "read",
                        "write"
                    ],
                    "analytics": [
                        "read",
                        "write"
                    ]
                }
            }
        }
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant