From c94a276a76484c3badd5deb617d24689372c414f Mon Sep 17 00:00:00 2001 From: Lemuel Smyth <36257395+lemsmyth@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:57:41 -0600 Subject: [PATCH] Checkbox set default publish (#52) * checkbox to set default publish --- classes/LBRY_Admin.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index 7cb8b03..72d672f 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -91,12 +91,23 @@ class LBRY_Admin ); add_settings_field( + + 'lbry_default_publish_setting', + 'Always Publish to LBRY', + array( $this, 'lbry_always_pub_callback' ), + LBRY_ADMIN_PAGE, + LBRY_SETTINGS_SECTION_GENERAL + ); + + add_settings_field( + 'default_lbry_channel', 'Default Publish Channel', array( $this, 'default_channel_callback' ), LBRY_ADMIN_PAGE, LBRY_SETTINGS_SECTION_GENERAL ); + add_settings_field( LBRY_LICENSE, 'LBRY Publishing License', @@ -261,6 +272,24 @@ class LBRY_Admin ); } + /** + * Checkbox to default to always allow publish on LBRY + */ + public function lbry_always_pub_callback() + { + $options = get_option( LBRY_SETTINGS )['lbry_default_publish_setting']; + if ( ! isset( $options ) ) { + $options = 0; + } + $checked = checked( $options, 1, false ); + printf( + '
Set Default to always Publish to LBRY, this can be adjusted when publishing a New Post.
', + 'lbry_default_publish_setting', + LBRY_SETTINGS, + + ); + } + /** * Prints select to choose a default to publish to channel */