Wallet balnce email #69

Merged
lemsmyth merged 14 commits from wallet-balnce-email into master 2022-02-19 22:08:06 +01:00
5 changed files with 46 additions and 6 deletions
Showing only changes of commit 9472f35587 - Show all commits

View file

@ -14,6 +14,12 @@
margin-bottom: -.2em;
}
.channel-bid-icon-lbc {
height: 1.1em;
margin-right: .1em;
margin-bottom: -.2em;
}
.lbry-pub-metabox {
margin: 0 0 0 -.2em;
padding: 0 .2em 0 0 ;
@ -21,7 +27,7 @@
.meta-icon-lbry {
height: 1.55em;
margin-bottom: -.4em;
padding-left: .1em;
padding: 0 .1em 0 0;
}
.lbry-meta-checkbox-wrapper {
padding: .5em .8em .6em;
@ -79,4 +85,4 @@
.lbry-meta-bx-content-last {
padding: .2em .8em 1em .1em;
}
}

View file

@ -256,8 +256,18 @@ class LBRY_Admin
if ( $channel_list ) { ?>
<ul class="lbry-channel-list">
<?php foreach ( $channel_list as $channel ) { ?>
<li><?php esc_html_e( $channel->name ) ?></li>
<?php foreach ( $channel_list as $channel ) {
$claim_id = $channel->claim_id;
$results = LBRY()->daemon->claim_search( $claim_id );
$lbry_url = $results->items[0]->canonical_url;
if ($lbry_url) {
$open_url = str_replace( 'lbry://', 'open.lbry.com/', $lbry_url );
}
$support_amount = $results->items[0]->meta->support_amount;
if ( ( $support_amount < 1 ) ? $support_amount = '0' : $support_amount = number_format( intval( $support_amount ) ) );
$init_bid = $results->items[0]->amount; ?>
<li><a href="<?php echo esc_url( $open_url, 'lbrypress' ); ?>"><?php esc_html_e( $channel->name, 'lbrypress' ) ?></a> <?php esc_html_e( $lbry_url, 'lbrypress'); ?> <span title="Initial Bid Amount: <?php esc_html_e( $init_bid, 'lbrypress' ); ?>"><img src="<?php echo esc_url( plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbc.png' ) ?>" class="icon icon-lbc bid-icon-lbc channel-bid-icon-lbc"><?php esc_html_e( $support_amount, 'lbrypress' ); ?></span></li>
<?php } ?>
</ul>
<?php } else { ?>

View file

@ -66,6 +66,30 @@ class LBRY_Daemon
}
}
/**
* Returns the info about a claim can get supports and initial bid amount when claim created among other information about a claim.
* TODO Can be build out later to accept more params
* @param string $claim_id
* @return object $result
*/
public function claim_search( $claim_id )
{
$params = array(
'claim_id' => $claim_id,
// 'name' => $norm_name,
// 'claim_type' => $claim_type,
);
try {
$result = $this->request( 'claim_search', $params );
$this->logger->log( 'Claim Search Results: ' . print_r( $result->result, true ) );
return $result->result;
} catch ( LBRYDaemonException $e ) {
$this->logger->log( 'claim_search error', $e->getMessage() . ' | Code: ' . $e->getCode() );
LBRY()->notice->set_notice( 'error', 'Issue getting claim search info' );
return;
}
}
/**
* Returns the available balance of a current LBRY account
* https://lbry.tech/api/sdk#wallet_balance

View file

@ -173,7 +173,7 @@ class LBRY_Network
} else {
printf (
'<div class="misc-pub-section lbry-meta-checkbox-wrapper lbry-meta-wrapper-last">
<span class="lbry-pub-metabox"><img src="' . __( '%1$s', 'lbrypress' ) . '" class="icon icon-lbry meta-icon-lbry"></span><span class="lbry-meta-label"> Publish to: <strong>' . esc_html__('LBRY', 'lbrypress') . '</strong></span><input type="checkbox" class="lbry-meta-checkbox" value="1"' . esc_attr('%2$s') . ' name="' . esc_attr('%3$s') . '">
<span class="lbry-pub-metabox"><img src="' . __( '%1$s', 'lbrypress' ) . '" class="icon icon-lbry meta-icon-lbry"></span><span class="lbry-meta-label">Publish to: <strong> LBRY </strong></span><input type="checkbox" class="lbry-meta-checkbox" value="1"' . esc_attr('%2$s') . ' name="' . esc_attr('%3$s') . '">
</div>',
plugin_dir_url( LBRY_PLUGIN_FILE ) . 'admin/images/lbry.png',
checked( $value, true, false ),

View file

@ -92,7 +92,7 @@ class LBRY_Network_Publisher
// Set License Published under
$published_license = $output->value->license;
if ( isset( $published_license ) && ( $published_license !== null ) ) {
if ( ( $published_license ) && ( $published_license !== null ) ) {
update_post_meta( $post->ID, '_lbry_post_published_license', $published_license );
}