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 canToggle filters for features #4

Merged
merged 5 commits into from
May 20, 2024
Merged

Conversation

circlecube
Copy link
Member

Adds a generic and feature-specific canToggle filter

Proposed changes

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

add a generic and feature specific filter
@circlecube circlecube requested a review from wpscholar May 20, 2024 13:31
@circlecube circlecube self-assigned this May 20, 2024
apply_filters(
// generic canToggle filter
'newfold/features/filter/canToggle',
current_user_can( 'manage_options' )
Copy link
Member

Choose a reason for hiding this comment

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

@circlecube Given that the idea was that someone would override the canToggleFeature method, perhaps we should create a separate, private method that handles the filters and just have this method handle the permission logic.

* main:
  add an onInit hook
  add before and after hooks for enable and disable methods
@circlecube circlecube requested a review from wpscholar May 20, 2024 15:54
@circlecube circlecube merged commit e46032e into main May 20, 2024
2 of 7 checks passed
@circlecube circlecube deleted the add/canToggle-filters branch May 20, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants