diff --git a/admin/css/lbry-admin.css b/admin/css/lbry-admin.css
index ed40079..5fea468 100644
--- a/admin/css/lbry-admin.css
+++ b/admin/css/lbry-admin.css
@@ -1,47 +1,82 @@
/**
- * Stylesheet for the admin options page
+ * Stylesheet for the admin pages LBRYPress uses
* @package LBRYPress
*/
- .wallet-icon-lbc {
- height: 1.8em;
- margin-right: .5em;
- margin-bottom: -.5em;
- }
-
- .bid-icon-lbc {
- height: 1.2em;
- margin-bottom: -.2em;
- }
+.wallet-icon-lbc {
+ height: 1.8em;
+ margin-right: .5em;
+ margin-bottom: -.5em;
+}
- .lbry-pub-metabox {
- margin: 0 0 0 -.2em;
- padding: 0 .2em 0 0 ;
- }
- .meta-icon-lbry {
- height: 1.55em;
- margin-bottom: -.4em;
- padding-left: .1em;
- }
- .lbry-meta-checkbox-wrapper {
- padding: .5em .8em .6em;
- }
-
- .lbry-meta-checkbox-wrapper-last {
- padding: .5em .8em 1.5em;
- }
- .lbry-meta-label {
- padding-left: .3em;
- padding-right: .6em;
- }
+.bid-icon-lbc {
+ height: 1.2em;
+ margin-bottom: -.2em;
+}
- .lbry-meta-bx-label {
- margin: .5em .8em .6em;
- }
+.lbry-pub-metabox {
+ margin: 0 0 0 -.2em;
+ padding: 0 .2em 0 0 ;
+}
+.meta-icon-lbry {
+ height: 1.55em;
+ margin-bottom: -.4em;
+ padding-left: .1em;
+}
+.lbry-meta-checkbox-wrapper {
+ padding: .5em .8em .6em;
+}
- .lbry-meta-bx-option {
- padding: .5em .8em .6em;
- }
- .lbry-meta-bx-option-last {
- padding: .5em .8em 1.5em;
- }
+.lbry-meta-wrapper-last {
+ padding: 0em .8em 1.2em;
+}
+
+.lbry-meta-label {
+ padding: .3em .6em .6em .1em;
+ /* padding-left: .3em;
+ padding-right: .6em;
+ padding-bottom: .5em; */
+}
+
+.lbry-meta-bx-label {
+ margin: .5em .8em .6em;
+}
+
+.lbry-meta-bx-option {
+ padding: .5em .8em .6em;
+}
+
+.lbry-meta-bx-option-last {
+ padding: .5em .8em 1.5em;
+}
+
+.lbry-hr-meta {
+ margin-left: 1em;
+ margin-right: 1em;
+}
+.post-lbry-display-before {
+ color: darkgreen;
+}
+.post-lbry-display {
+ color: green;
+}
+
+.lbry-pub-metabox {
+ margin: 0;
+ font-size: 1em;
+}
+
+.lbry-claim-id-metabox {
+ margin: 0;
+ padding-top: .3em;
+ font-size: .85em;
+ line-height: 1em;
+}
+
+.lbry-meta-bx-content {
+ padding: .2em .8em .6em .1em;
+}
+
+.lbry-meta-bx-content-last {
+ padding: .2em .8em 1em .1em;
+}
\ No newline at end of file
diff --git a/classes/LBRY_Network.php b/classes/LBRY_Network.php
index 4dab3b0..b64481b 100644
--- a/classes/LBRY_Network.php
+++ b/classes/LBRY_Network.php
@@ -120,11 +120,27 @@ class LBRY_Network
public function publish_to_lbry_checkbox( $post )
{
- $post_id = $post->ID;
-
if ( get_post_type( $post_id ) != 'post' ) {
return $post;
}
+ $post_id = $post->ID;
+ $lbry_claim_id = get_post_meta( $post_id, '_lbry_claim_id', true );
+ if ( $_GET['action'] === 'edit' ) {
+ if ( get_post_meta( $post_id, '_lbry_canonical_url', true ) == null || empty( get_post_meta( $post_id, '_lbry_canonical_url', true ) ) ) {
+ $canonical_url = LBRY()->daemon->canonical_url( $lbry_claim_id );
+ update_post_meta( $post_id, '_lbry_canonical_url', $canonical_url );
+ }
+ }
+ if ( ( get_post_meta( $post_id, '_lbry_will_publish', true ) == true ) && (isset( $lbry_claim_id ) ) ) {
+ update_post_meta( $post_id, '_lbry_is_published', true );
+ }
+ $lbry_published = get_post_meta( $post_id, '_lbry_is_published', true );
+ $lbry_url = ( get_post_meta( $post_id, '_lbry_canonical_url', true ) );
+
+ if ($lbry_url) {
+ $open_url = str_replace('lbry://', 'open.lbry.com/', $lbry_url );
+ }
+
$default_value = get_option( LBRY_SETTINGS )['lbry_default_publish_setting'];
$new_value = get_post_meta( $post_id, LBRY_WILL_PUBLISH, true );
if ( ( $new_value ) ? $new_value : $new_value = $default_value );
@@ -132,17 +148,38 @@ class LBRY_Network
if ( ( $value ) ? $value : 0 );
// nonce set on page meta-box.php
- printf (
- '
',
- plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png',
- 'Publish to',
- 'LBRY',
- 'lbrypress',
- checked( $value, true, false ),
- LBRY_WILL_PUBLISH
- );
+ if ( ( $lbry_published ) && ( ( $lbry_url) || ( $lbry_claim_id ) ) ) {
+ printf(
+ '
+
+
+
+
+ Update Post on: ' . esc_html__('LBRY', 'lbrypress') . '
+
',
+ plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png',
+ $open_url,
+ $lbry_url,
+ $lbry_claim_id,
+ checked( $value, true, false ),
+ LBRY_WILL_PUBLISH
+ );
+ } else {
+ printf (
+ '',
+ plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png',
+ checked( $value, true, false ),
+ LBRY_WILL_PUBLISH
+ );
+ }
}
/**
diff --git a/classes/LBRY_Network_Publisher.php b/classes/LBRY_Network_Publisher.php
index 0007b03..1b64e6f 100644
--- a/classes/LBRY_Network_Publisher.php
+++ b/classes/LBRY_Network_Publisher.php
@@ -84,9 +84,24 @@ class LBRY_Network_Publisher
// Set Claim ID
update_post_meta( $post->ID, LBRY_CLAIM_ID, $claim_id );
+ // Set Channel Name Published under
+ $published_channel = $output->signing_channel->name;
+ $channel_claim_id = $output->signing_channel->claim_id;
+ update_post_meta( $post->ID, '_lbry_post_published_channel', $published_channel );
+ update_post_meta( $post->ID, '_lbry_post_pub_channel_claim_id', $channel_claim_id );
+
+ // Set License Published under
+ $published_license = $output->value->license;
+ if ( isset( $published_license ) && ( $published_license !== null ) ) {
+ update_post_meta( $post->ID, '_lbry_post_published_license', $published_license );
+ }
+
// Set Canonical URL
$canonical_url = LBRY()->daemon->canonical_url( $claim_id );
update_post_meta( $post->ID, LBRY_CANONICAL_URL, $canonical_url );
+
+ // Set _lbry_is_published to true
+ update_post_meta( $post->ID, '_lbry_is_published', true );
}
} catch (Exception $e) {
error_log( 'Issue publishing post ' . $post->ID . ' to LBRY: ' . $e->getMessage() );
diff --git a/templates/meta-box.php b/templates/meta-box.php
index 68d51f1..d50abb2 100644
--- a/templates/meta-box.php
+++ b/templates/meta-box.php
@@ -12,58 +12,80 @@ $unnatributed = (object) array(
'name' => 'none (anonymous)',
'claim_id' => 'null'
);
+$post_id = $post->ID;
// Generate a custom nonce
$lbrynonce = wp_create_nonce( 'lbry_publish_post_nonce' );
+$lbry_published = get_post_meta( $post_id, '_lbry_is_published', true );
+$lbry_claim_id = get_post_meta( $post_id, '_lbry_claim_id', true );
+// $lbry_url = get_post_meta( $post_id, '_lbry_canonical_url', true );
+$lbry_published_channel = get_post_meta( $post_id, '_lbry_post_published_channel', true );
+if ( ! ( $lbry_published_channel ) ) {
+ LBRY()->daemon->claim_search( $lbry_claim_id );
+}
+$lbry_channel_claim_id = get_post_meta( $post_id, '_lbry_post_pub_channel', true );
+//if ( $lbry_channel_claim_id === null ? 'Anonymously' : $lbry_channel_claim_id);
+$lbry_published_license = get_post_meta( $post_id, '_lbry_post_pub_license', true );
+
$channels = LBRY()->daemon->channel_list();
$channels[] = $unnatributed;
-$post_id = $post->ID;
$cur_channel = ( get_post_meta( $post_id, LBRY_POST_PUB_CHANNEL, true ) ? get_post_meta( $post_id, LBRY_POST_PUB_CHANNEL, true ) : get_post_meta( $post_id, '_lbry_channel', true ) );
$default_channel = get_option( LBRY_SETTINGS )['default_lbry_channel'];
+$chan_open_url = ( 'open.lbry.com/'. $lbry_published_channel .'#' . $lbry_channel_claim_id . '');
// Sort the channels in a natural way
usort( $channels, array( 'LBRYPress', 'channel_name_comp' ) );
?>
-
-
-">$channel ) {
- $options .= '';
+ }
+ printf(
+ '',
+ LBRY_POST_PUB_CHANNEL,
+ $options
+ );
+ }
+ ?>
+ licenses;
+ $options = '';
+ $default_license = get_option(LBRY_SETTINGS)[LBRY_LICENSE];
+ $cur_license = get_post_meta( $post_id, LBRY_POST_PUB_LICENSE, true );
+
+ // Create options list, select current license
+ if ( $licenses ) {
+ foreach ( $licenses as $value => $name ) {
+ $options .= '';
- }
- printf(
- '',
- LBRY_POST_PUB_CHANNEL,
- $options
- );
- } ?>
-licenses;
- $options = '';
- $default_license = get_option(LBRY_SETTINGS)[LBRY_LICENSE];
- $cur_license = get_post_meta( $post_id, LBRY_POST_PUB_LICENSE, true );
-
- // Create options list, select current license
- if ( $licenses ) {
- foreach ( $licenses as $value => $name ) {
- $options .= '
+ printf(
+ '',
+ LBRY_POST_PUB_LICENSE,
+ $options
+ );
+ }
\ No newline at end of file