checkbox to set default publish

This commit is contained in:
Lem Smyth 2022-02-12 16:05:04 -06:00
parent 1245d0d9fb
commit 025106fcd6

View file

@ -90,6 +90,14 @@ class LBRY_Admin
LBRY_SETTINGS_SECTION_GENERAL LBRY_SETTINGS_SECTION_GENERAL
); );
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( add_settings_field(
'default_lbry_channel', 'default_lbry_channel',
'Default Publish Channel', 'Default Publish Channel',
@ -97,6 +105,7 @@ class LBRY_Admin
LBRY_ADMIN_PAGE, LBRY_ADMIN_PAGE,
LBRY_SETTINGS_SECTION_GENERAL LBRY_SETTINGS_SECTION_GENERAL
); );
add_settings_field( add_settings_field(
LBRY_LICENSE, LBRY_LICENSE,
'LBRY Publishing License', 'LBRY Publishing License',
@ -261,6 +270,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(
'<input type="checkbox" id="lbry_default_publish_setting" name="' . esc_attr('%2$s[%1$s]') . '" value="1" ' . esc_attr( $checked ) . '><p>Set Default to always Publish to <strong>LBRY</strong>, this can be adjusted when publishing a New Post.</p>',
'lbry_default_publish_setting',
LBRY_SETTINGS,
);
}
/** /**
* Prints select to choose a default to publish to channel * Prints select to choose a default to publish to channel
*/ */