feat(providers): opt-in filters for BuddyBoss + MemberPress (v1.6.0) - #15
Merged
Merged
Conversation
BREAKING: BuddyBossProfileTypeProvider and MemberPressMembershipProvider are now opt-in. Each provider's is_available() checks a new filter that defaults to false, so the provider is hidden from the React dropdown and denies on every check until the consumer plugin hooks the filter to return true. Existing rules saved against either provider deny by default after upgrade until the corresponding filter is set. Migration — in your consumer plugin's bootstrap: add_filter( 'wpb_access_control_bb_profile_type_enabled', '__return_true' ); add_filter( 'wpb_access_control_mepr_membership_enabled', '__return_true' ); Rationale: plugins that embed wpb-access-control via Composer were inheriting both third-party-provider options as soon as those plugins were active on the site, regardless of whether the embedding plugin intended to surface them. Defaulting to false keeps the library quiet by default; consumers opt in per provider. Files: - src/BuddyBossProfileTypeProvider.php — is_available() now requires the wpb_access_control_bb_profile_type_enabled filter (default false) in addition to the existing function_exists checks. - src/MemberPressMembershipProvider.php — is_available() now requires the wpb_access_control_mepr_membership_enabled filter (default false) in addition to the existing defined/class_exists checks. - tests/Unit/BuddyBossProfileTypeProviderTest.php — adds new test for the default-false gate; uses a static $opt_in_default property + an andReturnUsing closure in setUp so per-test overrides actually take effect (layered expectApplied calls don't override in Mockery). - tests/Unit/MemberPressMembershipProviderTest.php — same pattern. - README.md / CHANGELOG.md — documented the new filters and migration steps. PHPUnit: 160 tests / 218 assertions all green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BREAKING (BuddyBoss / MemberPress providers). Both third-party providers are now opt-in. Each provider's
is_available()consults a new filter that defaults tofalse, so the entry is hidden from the React dropdown and denies on every check until the consumer plugin hooks the filter totrue.Why
Plugins that embed
wpb-access-controlvia Composer were inheriting both third-party provider options as soon as those plugins were active on the site — regardless of whether the embedding plugin intended to surface BuddyBoss or MemberPress in its admin UI. Defaulting tofalsekeeps the library quiet by default; consumers opt in per provider.Migration
In your consumer plugin's bootstrap:
Existing rules saved against either provider deny by default after upgrading until the corresponding filter is hooked.
Changes
src/BuddyBossProfileTypeProvider.php—is_available()now also requireswpb_access_control_bb_profile_type_enabled === truesrc/MemberPressMembershipProvider.php—is_available()now also requireswpb_access_control_mepr_membership_enabled === truetests/Unit/BuddyBossProfileTypeProviderTest.php+tests/Unit/MemberPressMembershipProviderTest.php— add new default-false tests; switch to a static$opt_in_default+andReturnUsingclosure pattern insetUpso per-test overrides actually take effect (layeredexpectAppliedcalls don't override in Mockery)README.md/CHANGELOG.md— document the new filters and migration stepsNo JS / asset changes — purely PHP + tests + docs.
Test plan
composer test— 160 tests / 218 assertions, all green__return_true; confirm the options reappear and stored rules pass/deny correctly🤖 Generated with Claude Code