Add setting to enable Patreon unlock feature
This commit is contained in:
parent
83edc5ffb6
commit
bdb4f565e1
@ -3135,7 +3135,7 @@ function fictioneer_render_extra_metabox( $post ) {
|
||||
}
|
||||
|
||||
// Patreon (admin only)
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
if ( current_user_can( 'manage_options' ) && get_option( 'fictioneer_enable_patreon_locks' ) ) {
|
||||
$patreon_client_id = fictioneer_get_oauth_client_credentials( 'patreon' );
|
||||
$patreon_client_secret = fictioneer_get_oauth_client_credentials( 'patreon', 'secret' );
|
||||
|
||||
@ -3325,7 +3325,7 @@ function fictioneer_save_extra_metabox( $post_id ) {
|
||||
}
|
||||
|
||||
// Patreon (admin only)
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
if ( current_user_can( 'manage_options' ) && get_option( 'fictioneer_enable_patreon_locks' ) ) {
|
||||
$patreon_client_id = fictioneer_get_oauth_client_credentials( 'patreon' );
|
||||
$patreon_client_secret = fictioneer_get_oauth_client_credentials( 'patreon', 'secret' );
|
||||
$patreon_tiers = get_option( 'fictioneer_connection_patreon_tiers' );
|
||||
|
@ -473,7 +473,7 @@ function fictioneer_bypass_password( $required, $post ) {
|
||||
// Check Patreon tiers
|
||||
$user = wp_get_current_user();
|
||||
|
||||
if ( $user && $required ) {
|
||||
if ( $user && $required && get_option( 'fictioneer_enable_patreon_locks' ) ) {
|
||||
$patreon_lock_tiers = get_post_meta( $post->ID, 'fictioneer_patreon_lock_tiers', true );
|
||||
$patreon_lock_tiers = is_array( $patreon_lock_tiers ) ? $patreon_lock_tiers : [];
|
||||
$patreon_lock_amount = absint( get_post_meta( $post->ID, 'fictioneer_patreon_lock_amount', true ) );
|
||||
|
@ -698,6 +698,13 @@ define( 'FICTIONEER_OPTIONS', array(
|
||||
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
|
||||
'label' => __( 'Hide latest chapter list on large story cards', 'fictioneer' ),
|
||||
'default' => 0
|
||||
),
|
||||
'fictioneer_enable_patreon_locks' => array(
|
||||
'name' => 'fictioneer_enable_patreon_locks',
|
||||
'group' => 'fictioneer-settings-general-group',
|
||||
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
|
||||
'label' => __( 'Enable Patreon tiers to unlock protected posts', 'fictioneer' ),
|
||||
'default' => 0
|
||||
)
|
||||
),
|
||||
'integers' => array(
|
||||
|
@ -419,6 +419,15 @@
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="fictioneer-card__row">
|
||||
<?php
|
||||
fictioneer_settings_label_checkbox(
|
||||
'fictioneer_enable_patreon_locks',
|
||||
__( 'Requires OAuth 2.0 application for Patreon. Allows eligible logged-in supporters to ignore post passwords.', 'fictioneer' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="fictioneer-card__row">
|
||||
<?php
|
||||
fictioneer_settings_label_checkbox(
|
||||
|
Loading…
x
Reference in New Issue
Block a user