ndiego / block-visibility

Conditional visibility controls for all WordPress blocks.
https://www.blockvisibilitywp.com
GNU General Public License v2.0
123 stars 10 forks source link

Post visibility #90

Closed coreyworrell closed 11 months ago

coreyworrell commented 11 months ago

What problem does this address?

Provide a UI for setting visibility of entire post. Since the plugin name is "block-visibility", perhaps this could be a separate plugin that utilizes the existing components/functionality.

Use case example: a custom post type where each post is only viewable by a specific user role, and if user is not logged in or does not belong to that role then a (configurable) message would be shown, and an HTTP 403 header would be sent.

This could all be done outside of this plugin of course, but it would duplicate much of what Block Visibility already provides. Block Visibility has a really great UI/UX, and coding a standalone solution could clash and lead to confusion for editors who manage these posts.

What is your proposed solution?

It may already be the case, but the existing components could be made to handle props/handlers coming down from either block attributes, or post attributes.

ndiego commented 11 months ago

Hey @coreyworrell, thanks for opening an issue for this feature request. Unfortunately, this is not something that I am going to build into Block Visibility since it departs from the primary goal of the plugin, to conditionally display blocks.

That said, all the conditional code is available here should you want to repurpose it in another plugin.

coreyworrell commented 11 months ago

@ndiego Thank you. Yes I didn't think it would necessarily be a part of this plugin. The code you linked is useful, but the React components would be even more useful to reuse in the context of a post instead of a block. But I imagine that is much harder to repurpose those components in another plugin. It would be very neat though, especially with the Presets, and being able to share all of that between posts and blocks alike.