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 easy way to fully disable Push or Pull methods #815

Open
dkotter opened this issue Nov 5, 2021 · 3 comments
Open

Add easy way to fully disable Push or Pull methods #815

dkotter opened this issue Nov 5, 2021 · 3 comments
Labels
type:enhancement New feature or request.
Milestone

Comments

@dkotter
Copy link
Collaborator

dkotter commented Nov 5, 2021

Is your enhancement related to a problem? Please describe.
We support both Pushing and Pulling content out of the box but often sites will implement an editorial process that only uses one or the other. It's not bad to have both methods available but if one of those methods is never used or in a stricter editorial site where they want to ensure one method is never used, would be nice to fully disable that unused method.

Describe the solution you'd like
Ideally there would be a simple way to disable either Push or Pull. There are ways to do this now but they feel a little hacky and it's not really clear how to go about doing it.

I imagine two new filters (dt_is_pull_disabled, dt_is_push_disabled or similar) that return false by default but if you add your own custom code to return true instead, those methods are completely disabled.

@dkotter dkotter added the type:enhancement New feature or request. label Nov 5, 2021
@dkotter dkotter changed the title Add easy way to fully disabled Push or Pull methods Add easy way to fully disable Push or Pull methods Nov 5, 2021
@jeffpaul jeffpaul added this to the 2.1.0 milestone Mar 20, 2023
@jeffpaul
Copy link
Member

@peterwilsoncc
Copy link
Collaborator

WordPress's capability checking includes do_not_allow as a magic phrase to prevent users from doing an action. To disable pull permissions with the filters mentioned above can be done with:

add_filter( 'dt_pull_capabilities', function() { return 'do_not_allow'; } );

The above results in the check current_user_can( 'do_not_allow' ) which returns false for all users, including super admins. I think it's safe to close this as unplanned as the feature exists. Perhaps we can add this as a documentation enhancement.

@jeffpaul
Copy link
Member

Yeah, somehow adding into our docs would probably be good, perhaps in the Snippets section?

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
Status: To Do
Development

No branches or pull requests

3 participants