From 41b3c58d4174072ede9881d2861d5919e32e3280 Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Thu, 4 Oct 2018 19:19:06 -0500 Subject: [PATCH] Passing calls from options page to channel new --- classes/LBRY_Admin.php | 2 +- classes/LBRY_Daemon.php | 14 +++++++++++--- templates/options_page.php | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index 162ea10..d714ae9 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -192,7 +192,7 @@ class LBRY_Admin $bid_amount = $_POST['bid_amount']; // TODO: Wrap in a try catch - LBRY()->daemon->channel_new($new_channel, $bid_amount); + $result = LBRY()->daemon->channel_new($new_channel, $bid_amount); LBRY()->notice->set_notice('success', 'Successfully added a new channel!', true); } diff --git a/classes/LBRY_Daemon.php b/classes/LBRY_Daemon.php index e63b0d1..4d2beb5 100644 --- a/classes/LBRY_Daemon.php +++ b/classes/LBRY_Daemon.php @@ -41,12 +41,12 @@ class LBRY_Daemon /** * https://lbryio.github.io/lbry/#channel_list - * @return array claim dictionary + * @return array claim dictionary or null if empty */ public function channel_list() { - $result = $this->request('channel_list'); - return null; + $result = json_decode($this->request('channel_list'))->result; + return empty($result) ? null : $result; } /** @@ -55,6 +55,14 @@ class LBRY_Daemon */ public function channel_new($channel_name, $bid_amount) { + $result = $this->request( + 'channel_new', + array( + 'channel_name' => $channel_name, + 'amount' => $bid_amount + ) + ); + error_log($result); return null; } diff --git a/templates/options_page.php b/templates/options_page.php index 70aaf15..dfaaedd 100644 --- a/templates/options_page.php +++ b/templates/options_page.php @@ -20,7 +20,9 @@ $channel_list = $LBRY->daemon->channel_list();

Your Publishable Channels

- + $value): ?> + +

Looks like you haven't added any channels yet, feel free to do so below: