Skip to content

Commit

Permalink
Subscription: Add Filter to Allow Capability to be changed (#36909)
Browse files Browse the repository at this point in the history
* Add Subscriber Cap to Newsletter Block

* Add Subscriber Cap to Newsletter Block

* Add Doc Block and update filter name
  • Loading branch information
BrookeDot authored Apr 17, 2024
1 parent d63547d commit 050970a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/Subscriber-Cap-Filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Subscription: Add Filter to Allow Newsletter Block Meta to Capability to be Changed.
12 changes: 11 additions & 1 deletion projects/plugins/jetpack/modules/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,17 @@ public function maybe_set_first_published_status( $new_status, $old_status, $pos
* @return bool
*/
public function first_published_status_meta_auth_callback() {
if ( current_user_can( 'publish_posts' ) ) {
/**
* Filter the capability to view if a post was ever published in the Subscription Module.
*
* @module subscriptions
*
* @since $$next-version$$
*
* @param string $capability User capability needed to view if a post was ever published. Default to publish_posts.
*/
$capability = apply_filters( 'jetpack_subscriptions_post_was_ever_published_capability', 'publish_posts' );
if ( current_user_can( $capability ) ) {
return true;
}
return false;
Expand Down

0 comments on commit 050970a

Please sign in to comment.