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 Capability-Based Block Display Options #118

Open
qarayahya opened this issue Nov 20, 2024 · 2 comments
Open

Add Capability-Based Block Display Options #118

qarayahya opened this issue Nov 20, 2024 · 2 comments
Labels
Enhancement New enhancement or feature request.

Comments

@qarayahya
Copy link

qarayahya commented Nov 20, 2024

What problem does this address?

Currently, Block Visibility allows displaying blocks based on various criteria, such as user roles, page types, etc. However, it lacks the ability to control block visibility based on user capabilities. This limitation can be problematic when you want to display certain blocks only to users with specific permissions, regardless of their role.

What is your proposed solution?

Introduce a new capability-based option for displaying blocks. This option would allow users to specify a capability (e.g., "read_premium_posts") and only display the block if the current user has that capability.

Example:

  • Capability Field: Provide a field to input the desired capability slug (e.g., "read_premium_posts").
@ndiego ndiego added the Enhancement New enhancement or feature request. label Dec 1, 2024
@ndiego
Copy link
Owner

ndiego commented Dec 1, 2024

This should be relatively easy to add, but there are a lot of user capabilities in WordPress. Do you imagine this being a dropdown containing all Core capabilities or a text field? A text field is not as user-friendly, but this would allow BV to support custom capabilities. 🤔

@qarayahya
Copy link
Author

I’d go with a text field. It’s cleaner and supports custom capabilities. Maybe adding autocomplete for core capabilities could make it more user-friendly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New enhancement or feature request.
Projects
None yet
Development

No branches or pull requests

2 participants