Lbry publish #61
2 changed files with 50 additions and 3 deletions
|
@ -290,6 +290,55 @@ 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
|
||||||
|
*/
|
||||||
|
public function default_channel_callback()
|
||||||
|
{
|
||||||
|
$options = '';
|
||||||
|
$channel_list = LBRY()->daemon->channel_list();
|
||||||
|
|
||||||
|
if ( $channel_list ) {
|
||||||
|
foreach ( $channel_list as $channel ) {
|
||||||
|
$selected = $this->options['default_lbry_channel'] === $channel->claim_id;
|
||||||
|
|
||||||
|
$options .= '<option value="' . esc_attr( $channel->claim_id ) . '"';
|
||||||
|
if ( $selected ) {
|
||||||
|
$options .= ' selected';
|
||||||
|
}
|
||||||
|
$options .= '>' . esc_html( $channel->name ) . '</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
'<select id="' . esc_attr('%1$s') . '" name="' . esc_attr('%2$s[%1$s]') . '">' . esc_html('%3$s') . '</select>',
|
||||||
|
'default_lbry_channel',
|
||||||
|
LBRY_SETTINGS,
|
||||||
|
$options
|
||||||
|
);
|
||||||
|
} else { ?>
|
||||||
|
<p>Looks like you haven't added any channels yet, you can do that now on the <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'lbrypress', 'tab' => 'channels' ), 'options.php' ) ) ); ?>" class="">Channels Tab</a></p>
|
||||||
|
<?php }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checkbox to default to always allow publish on LBRY
|
* Checkbox to default to always allow publish on LBRY
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,10 +39,8 @@ class LBRY_Network
|
||||||
|
|
||||||
// Save the post meta on 'save_post' hook
|
// Save the post meta on 'save_post' hook
|
||||||
add_action( 'wp_insert_post', array( $this, 'save_post_meta' ), 11, 2 );
|
add_action( 'wp_insert_post', array( $this, 'save_post_meta' ), 11, 2 );
|
||||||
|
|
||||||
// Checkbox inside the WordPres meta box near "Publish" button
|
// Checkbox inside the WordPres meta box near "Publish" button
|
||||||
add_action( 'post_submitbox_misc_actions', array( $this, 'publish_to_lbry_checkbox' ) );
|
add_action( 'post_submitbox_misc_actions', array( $this, 'publish_to_lbry_checkbox' ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue